| ||||||||||
| 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 | |||||||||
如此水的题目憋这么长时间,问大牛点问题,AC后仍不懂#include<stdio.h>
#include<string.h>
int main()
{
int temp,p = 0;
char a[10] , sum[11];
memset(sum , '0' ,sizeof(char) * 10);
scanf("%s" , &sum);
while(scanf("%s" , &a) == 1)
{
for(temp =0 ; temp < strlen(a) ; temp++)
sum[temp] = (a[temp] + sum[temp] - 2* '0') % 10 + '0';
if( p < strlen(a))
p = strlen(a);
}
fflush(stdin);
for(temp = 0; temp < p; temp ++)
printf("%c" , sum[temp]);
printf("\n");
return 0;
}
跟踪的时候在ffush(stdin);抛出异常,说是因为EOF.不懂
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator