| ||||||||||
| 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 | |||||||||
Re:哈哈,勉强到了170MS,各位大侠帮看看咋还能更快的?In Reply To:Re:哈哈,勉强到了170MS,各位大侠帮看看咋还能更快的? Posted by:CTcoolL at 2008-06-01 14:49:32 > 呃 我拿你的交怎么1922ms? 人品问题?
# include <stdio.h>
# include <string.h>
const int N=1000001;
char a[N],b[N],s[N];
int main(){
int n,i;
bool pd;
scanf("%d",&n);
getchar();
for(i=0;i<n;i++){
a[i]=getchar();
getchar();
b[i]=getchar();
getchar();
}
pd=false;
s[n]='\0';
for(i=n-1;i>=0;i--){
if(pd) {
s[i]=(a[i]+b[i]+1-'0'-'0')%10+'0';
if(a[i]+b[i]+1-'0'-'0'>=10)
pd=true;
else pd=false;
}
else {
s[i]=(a[i]+b[i]-'0'-'0')%10+'0';
if(a[i]+b[i]-'0'-'0'>=10)
pd=true;
else pd=false;
}
}
puts(s);
return 1;
}
我这个也要1522MS,是不是加数据了?
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator