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 |
超时 n次 !!!开始用scanf printf 超时 改成getchar putchar 用gcc 提交 125 ms~ (附代码) #include<stdio.h> #include<string.h> #include<stdlib.h> int n,a[1000001]; int main() { int i,x,y;char s,t; scanf("%d",&n); getchar(); for(i=0;i<n;i++) { s=getchar();getchar(); t=getchar();getchar(); x=s-'0';y=t-'0'; a[i]=x+y; } for(i=n-1;i>=1;i--) if(a[i]>=10){a[i]=a[i]%10;a[i-1]++;} for(i=0;i<n;i++) {s=a[i]+'0'; putchar(s); } system("pause"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator