Conditionally rich numbers

아직 제출이 없습니다시간 제한0.18초메모리 제한1024 MB

문제

Mariya has come up with the following definition for a rich number. It is given a positive integer XX. Then a positive integer NN is called a rich number (relative to XX) if the sum of its divisors except NN is greater than XX. For example, the number 1010 (whose sum of divisors is 1+2+5=81+2+5 = 8) is rich relative to X=7X=7 but it isn’t rich relative to X=12X=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)(L, R, V) and for each query it should calculate the number of rich numbers relative to VV, which are greater than or equal to LL and less than or equal to RR.

입력

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

Each of the next QQ lines contains three positive integers LL, RR and VV, which describe a query for your program to process.

출력

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

제한

  • 1Q1051 ≤ Q ≤ 10^5
  • 1LR1051 ≤ L ≤ R ≤ 10^5
  • 1V1051 ≤ V ≤ 10^5