Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么WA 郁闷!测试过所以的数据拉

Posted by heiheigo at 2005-05-31 22:56:30 on Problem 1775
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator