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

Re:为什么这样是错的?要字符存储有什么好处?

Posted by jince at 2009-10-23 19:11:44 on Problem 2602
In Reply To:为什么这样是错的? Posted by:jince at 2009-10-23 19:10:58
> #include<stdio.h>
> int s[1000000];
> int main()
> {
> 	int n,k,i,m;
> 	int x,y;
> 	scanf("%d",&n);
> 	for(i=0;i<n;i++)
> 	{
> 		scanf("%d %d",&x,&y);
> 		s[i]=x+y;
> 	}
> 	k=0;
> 	for(i=n-1;i>=0;i--)
> 	{
> 	
> 		m=s[i]%10+k;
> 		k=s[i]/10;
> 		s[i]=m;
> 	}
> 	for(i=0;i<n;i++)
> 		printf("%d",s[i]);
> 	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