022 school recruit Zhenti exercise number of (NetEase)

Number of

Title Description
beef before the teacher had obtained a number of positive integers (x, y), beef forget how much they are a specific.
But the Taurus remember the teacher told him not greater than x and y n, and x divided by y is greater than or equal k.
Taurus hope you can help him calculate the total number of a number of possible pairs.

Input Description :
input comprises two positive integers n, k (1 <= n <= 10 ^ 5, 0 <= k <= n - 1).

Description Output :
For each test case, the output of a number of possible positive integer number.

 1 def main():
 2     n, k = map(int, input().split())
 3     count = 0
 4     if k == 0:
 5         count = n * n
 6     else:
 7         for y in range(k+1, n+1):
 8             count += (n // y) * (y - k)
 9             if n % y >= k:
10                 count += (n % y - k + 1)
11     print(count)
12 
13 if __name__ == '__main__':
14     main()

I will not do, when confronted with such mathematical topics they covered.

Reference: https://www.nowcoder.com/profile/3865993/codeBookDetail?submissionId=25827709

Guess you like

Origin www.cnblogs.com/asenyang/p/11228857.html