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

错得无语了~~~~~急救呀…………

Posted by coffeeandtea at 2007-01-23 14:32:45 on Problem 2316
#include<stdio.h>
#include<string.h>
char num[15];
int main()
{
	int i,len;
	int total[15];
	for(i=0;i<15;i++)
	{
		total[i]=0;
	}
		memset(num,0,sizeof(num));
	//	scanf("%s",num);
	while(scanf(" %s",num)!=EOF)
//	while(gets(num)!=0)
	{
		//	printf("fsdafasdf\n");
		len=strlen(num);
		for(i=0;i<len;i++)
		{
	//		printf("%c",total[i]);
			if((total[i]+(num[i]-'0'))>=10)
			{
			 total[i]=total[i]+(num[i]-'0')-10;
			}
			else
			{
			 total[i]=total[i]+(num[i]-'0');
			}
		}
		memset(num,0,sizeof(num));
	} 
//	printf("fsdafasdf\n");
	for(i=0;i<len;i++)
   {
	 	printf("%d",total[i]);
	}
//getchar();
	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