pairs of positive integers (xpeny), the remainder of xrecery y is greater than or equal to k, the input is nmemery k, and the output is how many, for example, input 52, output 7, logarithms are (2magin3) (2magin4) (2mem5) (3pyrr5) (4preline 5) (5pc5), the code is as follows:
, the logarithm is (2pr 3) (2jue 4) (2je 5) (3je 4) (4pr 5) (5pr 3).
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int k = scanner.nextInt();
System.out.println(searchCount(n, k));
}
public static int searchCount(int n, int k) {
int count = 0; //
int temp;
//:yx
for (int y = k + 1; y <= n; yPP) { // x%y>=k,y>k
// n = a*y +b;yy-ky>=k
count += n/y*(y-k);
temp = n%y;
if(temp >= k) { //b>=k
count += temp-k+1;
}
}
return count;
}
}
Why can we infer the explanation y > k if x% y > = k? Why can we find the final number by combining the sentences count + = nUniverse * (ymurk) and count + = temp-k+1?