import java.util.Scanner; public class Main {     public static int huaff( int n, int k){         int left = (n + k) / 2;         int sum = 0;         int right = left - k;         if (left - right != k || right <= 0 || left <= 0 || left + right != n){             return sum + 1;         }         return huaff(left, k) + huaff(right, k);     }     public static void main(String[] args) {         Scanner in = new Scanner(System.in);         int  n = in.nextInt();         int k = in.nextInt();         int sum = huaff(n, k);         System.out.println(sum);     } } 只会第二题
点赞 1

相关推荐

不愿透露姓名的神秘牛友
昨天 17:51
点赞 评论 收藏
分享
快点约我面试吧
投递百度等公司10个岗位
点赞 评论 收藏
分享
06-07 17:17
嘉兴学院 教师
心爱的idea:你孩
点赞 评论 收藏
分享
07-24 19:01
门头沟学院 Java
后天笔试,又要开始做题了
Sairus:明天10:00笔试
投递京东等公司10个岗位
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务