Frequent Prime RangesProblem code: TECH12 |
A range [L..H] is called a K-Frequent Prime range if there are atleast K primes amongst the numbers L,L+1,..,H.
Given N and K, calculate how many subranges of the range [2..N] are K-Frequent Prime.
Input
The first line contains the number of test cases T (<= 100). Each of the next T lines contains 2 integers N and K. (2 <= N <= 100000, 0 <= K <= 10000)
Output
Output T lines, one corresponding to each test case, containing the required answer.
Example
Input: 4 2 1 5 2 5 1 9 3 Output: 1 4 9 8
Note: For the first test case, the only valid subrange is [2..2], whereas for the second test case, the valid subranges are : [2..3],[2..4],[2..5],[3..5].
| Author: | technovanza10 |
| Date Added: | 24-01-2010 |
| Time Limit: | 4 sec |
| Source Limit: | 50000 Bytes |
| Languages: | C, C99 strict, CLOJ, CPP 4.0.0-8, CPP 4.3.2, F#, GO, JAVA, PERL6, PYTH 3.1.2, TEXT |
Comments

Fetching successful submissions

How's solution for case: 5 1
How's solution for case: 5 1 is 9 ?
ok got it..
ok got it..