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

给代码你们,所有数据都过了

Posted by masterking at 2010-01-09 13:03:23 on Problem 3508
In Reply To:对付WA最有效的数据…… Posted by:MIRKING at 2008-07-26 15:18:42
#include "stdio.h"
#include "math.h"
int main()
{
	long i,n,k,t,a,m=0;
	while(1)
	{
		scanf("%ld",&n);
		if(n==0)
			break;
		a=n;
		m=m+1;
		for(i=0;n;i++)
			n=n/10;
		for(k=1;i;i--)
			k=k*10;
		for(t=1;t<=10;t++)
		{		
			if((a+k*t)%11==0)
			{
				printf("%ld. %ld\n",m,(a+k*t)/11);
				break;
			}
		}
		if(t==11)printf("%ld. IMPOSSIBLE\n",m);
	}
	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