第三题我的代码,麻烦大家看看,是不是正确的? import java.util.Scanner; public class Main {     public static void main(String[] args) {         Scanner in = new Scanner(System.in);         int n = in.nextInt();         int k = in.nextInt();         System.out.println(core(n, k));     }     public static int core(int n, int k) {         int count = 0;         for (int y = k + 1; y <= n; y++) {             int i = n/y;             count += i*(y-k);             if(n%y >=k){                 count += n%y -k +1;             }         }         return count;     } }
点赞 1

相关推荐

纯真的河老师在喝茶:第一个是这个时间点岗位少,第二个是这个简历重复度太高了,10个有9个简历差不多的
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务