-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathC.cpp
46 lines (45 loc) · 978 Bytes
/
C.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
//Number game (Incomplete)
#include<stdio.h>
int main()
{
long long int i,t,n,m,p=0;
scanf("%lld",&t);
while(t--)
{
scanf("%lld",&n);
if(n==1)
printf("FastestFinger\n");
else if(n%2==1)
printf("Ashishgup\n");
else if(n%4==0)
{
m=n;
while(m%2==0)
m=m/2;
if(m==1)
printf("FastestFinger\n");
else
printf("Ashishgup\n");
}
else
{
if(n/2==1)
printf("Ashishgup\n");
else
{
p=0;
n=n/2;
for(i=3;i*i<=n;i++)
{
if(n%i==0)
p=1;
}
if(p==0)
printf("FastestFinger\n");
else
printf("Ashishgup\n");
}
}
}
return 0;
}