-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1028.c
53 lines (45 loc) · 991 Bytes
/
1028.c
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
#include<stdio.h>
#include<stdio.h>
#include<math.h>
int primes[78550];
char arr[1000100];
int cnt=1;
void ops(int n) {
for(long long i=3; i*i<=n; i+=2) {
if(arr[i]==0) {
for(long long j=i*i; j<=n ; j+=i) {
arr[j]='a';
}
}
}
primes[0]=2;
for(int i=3; i<=n; i+=2) {
if(arr[i]==0)
primes[cnt++]=i;
}
}
int main() {
ops(1000100);
// printf("%d\n",primes[cnt-1]);
int T,caseno=0;
scanf("%d",&T);
while(T--) {
long long n,res;
scanf("%lld",&n);
int c;
res=1;
int root=round(sqrt(n));
for(int i=0; primes[i]<=root; i++) {
c=1;
while(n%primes[i]==0) {
n=n/primes[i];
c++;
}
res*=c;
root=sqrt(n);
}
if(n!=1)res*=2;
printf("Case %d: %lld\n",++caseno,res-1);
}
return 0;
}