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

例子都对,就是过不了,running error!

Posted by Nedvid at 2008-03-07 19:39:47 on Problem 3508
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
void main()
{
	char s[100],str[100],*end,*c;
	long a,b,sum,n=1,k;int i;
	while(scanf("%s",str)&&str[0]!='0')
	{
		for(i=1;i<=10;i++)
		{
			k=strlen(str);
		    sum=strtol(str,&end,10);
			sum=sum+i*pow(10,k);
		if(sum%11==0)
		{b=sum/11;printf("%ld. %ld\n",n,b);break;}
		else if(i>=10)printf("%ld. IMPOSSIBLE\n",n);
		}
		n++;
	}
}



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