| ||||||||||
| 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 | |||||||||
险啊,1.5s#include<stdio.h>
main()
{
long n;
char num[1000001];
int i,j;
int a,b;
for(i=0;i<1000001;i++)
num[i]=0;
scanf("%ld",&n);
for(i=0;i<n;i++)
{
scanf("%d %d",&a,&b);
num[i]=a+b;
}
for(i=n-1;i>=0;i--)
{
if(num[i]>=10)
{
num[i-1]+=num[i]/10;
num[i]=num[i]%10;
}
num[i]+='0';
}
printf("%s\n",num);
}
-------------------------------
用字符数组就不会RE,如果用int ,short连本地测试都过不了。
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator