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

Help 帮忙解释一下

Posted by 00403022 at 2005-04-29 20:44:12 on Problem 2316
这题有什么特别之处吗,为什么总是WA?

#include<iostream.h>
#include<string.h>
void main()
{
	int digit[12],move[12];
	int i;
	i=0;
	char s[12];
	cin.getline(s,12);
	int n=strlen(s);
	for (i=0;i<n;i++)
		digit[i]=s[i]-'0';
	memset(move,0,sizeof(move));

	while (cin.getline(s,12))
	{
		for (i=0;i<n;i++)
			move[i]+=s[i]-'0';
	}
	for (i=0;i<n;i++)
	{
		move[i]%=10;
		digit[i]+=move[i];
		digit[i]%=10;
	}
	for (i=0;i<n;i++)
		cout<<digit[i];
	cout<<endl;
}

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