Create 2854.cpp

pull/22/head
Kirigaya Kazuto 2016-07-04 09:45:54 +08:00 committed by GitHub
parent 32543464c2
commit 31504a798a
1 changed files with 66 additions and 0 deletions

66
HDOJ/2854.cpp Normal file
View File

@ -0,0 +1,66 @@
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;
/*
int main()
{
/// Test Program
int N;
for(N=1;N<5005;N++)
{
bool isOK=false;
for(int A=1;A<=N;A++)
{
for(int B=1;B<=N;B++)
{
if((A*A*B+1)%N==0)
{
if((A*A+B)%N==0)
{
//printf("A=%d B=%d\n",A,B);
isOK=true;
}
else
{
goto OUT;
}
}
}
}
if(isOK)
{
printf("%d,",N);
}
OUT:continue;
}
}
//*/
int a[]={1,2,3,4,5,6,8,10,12,15,16,20,24,30,40,48,60,80,120,240};
const int sza=sizeof(a)/sizeof(int);
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int x;
scanf("%d",&x);
bool isFound=false;
for(int i=0;i<sza;i++)
{
if(a[i]==x)
{
printf("YES\n");isFound=true;break;
}
}
if(!isFound)
{
printf("NO\n");
}
}
return 0;
}