-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11876.cpp
More file actions
33 lines (31 loc) · 757 Bytes
/
11876.cpp
File metadata and controls
33 lines (31 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int dv[1000010];
void call(void) {
int i, j, k, l;
memset(dv, 0, sizeof(dv));
for (i = 1; i <= 1000000; i++) {
for (j = i; j <= 1000000; j += i) dv[j]++;
}
v.push_back(1);
k = 1;
while (k < 1000000) {
k = k + dv[k];
v.push_back(k);
}
}
int main() {
call();
int tc, i, j, k, l;
scanf("%d", &tc);
for (int t = 1; t <= tc; t++) {
scanf("%d %d", &k, &l);
vector<int>::iterator low, high;
low = lower_bound(v.begin(), v.end(), k);
high = upper_bound(v.begin(), v.end(), l);
int sum = (high - v.begin()) - (low - v.begin());
printf("Case %d: %d\n", t, sum);
}
return 0;
}