| ||||||||||
| 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>
#include<string.h>
int main()
{
char a[1000000],k=0;
scanf("%s",a);
while(strcmp(a,"0")!=0)
{
k ++;
int i,t1 = 0,t2 = 0;
int result;
for( i = strlen(a)-1; i>=0 ; i --)
{
int temp = a[i] - '0';
int tr = temp - t1 - t2 ;
result = tr ;
if( result < 0 ) result += 10;
t1 = result;
if( tr < 0 ) t2 = 1 ;
else t2 = 0 ;
a[i] = '0' + result;
}
if(a[0] == '0')
{
printf("%d. IMPOSSIBLE\n",k);
}
else printf("%d. %s\n",k,a);
scanf("%s",a);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator