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:哈哈,勉强到了170MS,各位大侠帮看看咋还能更快的? Posted by:alawing at 2006-12-28 01:33:15 #include<stdio.h> int main() { char letter[100000][3]; int num,i; int flag=0; scanf("%d",&num); getchar(); for(i=0;i<num;i++) { scanf("%c%*1c%c",&letter[i][0],&letter[i][1]); getchar(); } for(i=num-1;i>-1;i--) { letter[i][2]=letter[i][0]+letter[i][1]+flag-48; if(letter[i][2]-48>9) { flag=1; letter[i][2]-=10; } else flag=0; } if(flag) { printf("%c",'1'); } for(i=0;i<num;i++) { printf("%c",letter[i][2]); } printf("\n"); return 0; } 我的这个和你那个差不多啊,咋还超了呢? Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator