-
Notifications
You must be signed in to change notification settings - Fork 0
/
1028-Trailing_Zeroes(I).cpp
65 lines (56 loc) · 1.45 KB
/
1028-Trailing_Zeroes(I).cpp
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <bits/stdc++.h>
using namespace std;
struct Prime {
int n, siz;
vector<int> primes;
bitset<(int) 1e6 + 7> ok;
Prime () = default;
Prime (int _n) {
n = _n;
ok.reset();
ok[1] = 1;
int lim = sqrt(n) + 1;
for (int i = 4; i <= n; i += 2) ok[i] = 1;
for (int i = 3; i < lim; ++i)
if (!ok[i]) for (int j = i * i; j <=n ; j += (i + i)) ok[j] = 1;
}
inline bool is_prime (int x) {return !ok[x];}
inline void enlist () {
primes.push_back(2);
for (int i = 3; i <= n; i += 2)
if(!ok[i]) primes.push_back(i);
siz = primes.size();
}
int nowsz () {return siz;}
inline int xth (int x) {int ssz = primes.size(); return ssz > x ? -1 : primes[x-1];}
};
Prime P ((int) 1e6+7);
void solve () {
int64_t n, cnt = 1, po, now, psz = P.primes.size();
cin >> n;
for (int i = 0; i < psz && P.primes[i] * P.primes[i] <= n; ++i) {
po = 0, now = P.primes[i];
if (n % now == 0) {
while (n % now == 0) {
po++;
n /= now;
}
cnt *= (po+1);
}
}
if (n != 1)
cnt *= 2;
cout << cnt - 1 << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie (0); cout.tie(0);
P.enlist();
int tt = 1, tc = 1;
cin >> tt;
while (tt--) {
cout << "Case " << tc++ << ": ";
solve ();
}
return 0;
}