시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.18 초 1024 MB44141028.571%

문제

Mariya has come up with the following definition for a rich number. It is given a positive integer $X$. Then a positive integer $N$ is called a rich number (relative to $X$) if the sum of its divisors except $N$ is greater than $X$. For example, the number $10$ (whose sum of divisors is $1+2+5 = 8$) is rich relative to $X=7$ but it isn’t rich relative to $X=12$.

Write a program rich_num to help Mariya. The program will be given queries that are ordered triples of positive integers $(L, R, V)$ and for each query it should calculate the number of rich numbers relative to $V$, which are greater than or equal to $L$ and less than or equal to $R$.

입력

The first line of the standard input contains one positive integer $Q$ – the number of queries that your program has to process.

Each of the next $Q$ lines contains three positive integers $L$, $R$ and $V$, which describe a query for your program to process.

출력

Your program should output to the standard output $Q$ lines – one line for each query in the order of the input. Each line should contain the answer to the corresponding query.

제한

  • $1 ≤ Q ≤ 10^5$
  • $1 ≤ L ≤ R ≤ 10^5$
  • $1 ≤ V ≤ 10^5$

서브태스크

번호배점제한
15

$Q \le 10^3$, $R \le 10^3$, $V \le 10^5$

210

$Q \le 10^5$, $R \le 10^4$, $V = 10$

330

$Q \le 10^5$, $R \le 10^5$, $V \le 10$

455

$Q \le 10^5$, $R \le 10^5$, $V \le 10^5$

예제 입력 1

3
5 15 5
1 20 20
12 20 10

예제 출력 1

6
2
4

채점 및 기타 정보

  • 예제는 채점하지 않는다.