| ||||||||||
Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
开的很小为什么空间不足??????#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator