-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbeehivenumbers.c
35 lines (34 loc) · 940 Bytes
/
beehivenumbers.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
#include<stdio.h>
int main(){
int x;
scanf("%d",&x);
int i=1;
x=x-1;
while(x!=-2){
if(x==0){
i=0;
printf("Y\n");
}else if(x%6==0){
int n=2;
int t=3*n*n-3*n;
while(t<=x){
t=3*n*n-3*n;
if(x==t){
i=0;
printf("Y\n");
break;
}
n++;
}
}
if(i==1){
printf("N\n");
i=1;
}
int y;
scanf("%d",&y);
x=y-1;
i=1;
}
return 0;
}