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

2316

Posted by sh2010508231 at 2011-04-06 19:38:32 on Problem 2316
#include<stdio.h>
#include<string.h>
int main()
{
	char s1[12],s2[12];
	int j;
	for(j=0;j<11;j++)
		s2[j]='0';
	s2[j]='\0';
	int len;
	while(scanf("%s",s1)==1)
	{
		len=strlen(s1);
		for(int i=0;i<len;i++)
		{
			s2[i]=(((s2[i]-'0')+(s1[i]-'0'))%10)+'0';//此处因为s2定义的是char型,所以要加  ‘0’让它变成字符
		}
	}
	for(j=0;j<len;j++)
		printf("%c",s2[j]);
	printf("\n");
	return 0;
}


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