-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLightOj 1028.cpp
103 lines (72 loc) · 1.63 KB
/
LightOj 1028.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* Which of the favors of your Lord will you deny? */
#include<bits/stdc++.h>
using namespace std;
#define SI(n) scanf("%d",&n)
#define SLL(n) scanf("%lld",&n)
#define SULL(n) scanf("%llu",&n)
#define SC(n) scanf("%c",&n)
#define SD(n) scanf("%lf",&n)
#define fr(i,a,b) for(int i=a ,_b=(b) ;i<= _b;i++)
#define LL long long
#define PUB push_back
#define POB pop_back
#define MP make_pair;
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define mset(x,v) memset(x,v,sizeof(x))
#define GCD __gcd
#define DEBUG cout<<"aw"<<endl;
//int LIM1=1005;
int LIM2=1000005;
bool isP[1000010];
vector<int> primes;
void sieve()
{
//primes.reserve(LIM2);
fr(j,1,LIM2)
isP[j]=true;
for(int j=2; j<=LIM2; j++)
{
if(isP[j]==true)
{
primes.PUB(j);
for(int k=2; (j*k)<=LIM2; k++)
isP[j*k]=false;
}
}
return;
}
int main()
{
//freopen("LOJ1028.txt","w",stdout);
sieve();
int tc;
SI(tc);
fr(i,1,tc)
{
LL num;
SLL(num);
int factorNum = 1;
for(int j=0; primes[j]<=sqrt(num) ; j++)
{
if(num<=1000000)
{
if(isP[num]==true)
break;
}
int k = 0;
int x = primes[j];
while(num%x==0)
{
num=num/x;
k++;
}
factorNum = factorNum * (k+1);
//cout<<"**"<<j<<endl;
}
if(num>1)
factorNum *= 2;
printf("Case %d: %d\n",i,factorNum-1);
}
return 0;
}