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

如此水的题目憋这么长时间,问大牛点问题,AC后仍不懂

Posted by uljfwffj1 at 2010-04-17 10:41:02 on Problem 2316
#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:
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