| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为什么WA 郁闷!测试过所以的数据拉#include "stdio.h"
int main(){
long a,b,c;
int i;
int flag=0,flag1=0;
while(scanf("%ld",&a)!=EOF){
if(a<=0) break;
b=a;
c=a-1;
if(a==1||a==2){
printf("YES\n");
continue;
}
if(a>409114){
printf("NO\n");
continue;
}
else{
for(i=2;i<=9;i++){
if(b%i>1){
flag=1;
i=10;
}
else
b=b/i;
}
for(i=2;i<=9;i++){
if(c%i>1){
flag1=1;
i=10;
}
else
c=c/i;
}
if(flag==1&&flag1==1)
printf("NO\n");
else
printf("YES\n");
}
flag=0;
flag1=0;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator