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

Re:这样为什么会WA?请教。。

Posted by link85 at 2007-04-20 13:22:29 on Problem 2190
In Reply To:这样为什么会WA?请教。。 Posted by:0406340341 at 2007-01-24 19:59:53
> #include<stdio.h>
> int main()
> {
> 	char isbn[11];
> 	int n=0,i,x,y;
> 	scanf("%s",isbn);
> 	if(isbn[9]=='X') n=10;
> 	else if(isbn[9]=='?') n=0,x=1;
> 	else n=isbn[9]-'0';
> 	for(i=10;i>1;i--)
> 	{
> 		if(isbn[10-i]=='?') {x=i;continue;}
> 		n+=(isbn[10-i]-'0')*i;
> 	}
> 	y=11-n%11;
> 	while(1)
> 	{
> 		if(y%x==0||y/x>10) break;
> 		y+=11;
> 	}
> 	if(y/x<10&&y/x>=0) printf("%d\n",y/x);
> 	else if(y==10&&x==1) printf("X\n");
> 	else printf("-1\n");
> 	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