Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import static java.lang.Math.*;
- import static java.util.Arrays.*;
- import java.util.*;
- public class B {
- Scanner sc = new Scanner(System.in);
- int N = 10000001;
- void run() {
- int caseN = sc.nextInt();
- int[] num = new int[N];
- for (int i = 2; i < N; i++) if (num[i] == 0) {
- num[i]++;
- for (int j = i * 2; j < N; j += i) {
- num[j]++;
- }
- }
- for (int caseID = 0; caseID < caseN; caseID++) {
- int a = sc.nextInt(), b = sc.nextInt(), n = sc.nextInt();
- int res = 0;
- for (int i = a; i <= b; i++) if (num[i] == n) res++;
- System.out.println(res);
- }
- }
- void debug(Object...os) {
- System.err.println(deepToString(os));
- }
- public static void main(String[] args) {
- new B().run();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement