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 xiaoha at 2005-09-21 10:09:53 on Problem 2602
In Reply To:菜鸟求救,请大牛指点迷津。 Posted by:change at 2005-09-20 23:34:17
在你的电脑上开不了那么大的内存
但是测试的时候可以分配给你那么大的内存
尽管开大一点就可以拉
只要保证思路对就行


> #include"stdio.h"
> #define M 100000   //再开大10倍就不行了,所以达不到要求。我不知道有什么解法,请大牛们不吝赐教!
> int main()
> {
> 	int i,n,d1,d2,c,a[];	
> 	scanf("%d",&n);
> 	    for(i=n;i>=1;i--)
> 		{   
> 			scanf("%d%d",&d1,&d2);    
> 	    	c=d1+d2;			
> 			if(c>=10)
> 			{
> 		    	a[i]=c%10;
> 			    a[i+1]++;
> 			}
> 			else a[i]=c;
> 			
> 		}		
> 
> 		for(i=n;i>=1;i--)
> 			printf("%d",a[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