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 yipeng at 2004-05-27 15:39:39 on Problem 1504
#include "stdio.h"
void main(){
	int t,i,j,k,l1,l2;
    int a1[11],a2[11];
	char c;
	scanf("%ld",&t);
	for(i=1;i<=t;i++){
		l1=l2=10;
		for(j=10;j>=0;j--)
			a1[j]=a2[j]=0;
		scanf("%c",&c);
		while(c==' '||c=='\n')
			scanf("%c",&c);
		while(c!=' '){	    
			k=c-'0';
			a1[l1]=k;
			l1--;
			scanf("%c",&c);
		}
		while(c==' ')
			scanf("%c",&c);
		while(c!='\n'&&c!=' '){
			k=c-'0';
			a2[l2]=k;
			l2--;
			scanf("%c",&c);
		}
		for(j=10;j>=1;j--){
			a1[j]=a1[j]+a2[j];
			if(a1[j]>=10){
				a1[j]=a1[j]%10;
				a1[j-1]++;
			}
		}
		l1=0;
		while(a1[l1]==0){
			l1++;
		}
		l2=10;
		while(a1[l2]==0)
			l2--;
		while(l2>=l1){
			printf("%d",a1[l2]);
			l2--;
		}
		printf("\n");
	}
}

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