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多数据都真确为什么WA?#include <iostream> using namespace std; void main() { int i,num=0,n,a,b,t=-1,k; cin>>n; while(n--) { cin>>a>>b; k=a+b; if(k<9) { if(t!=-1) cout<<t; if(num) { for(i=0;i<num;i++) cout<<9; num=0; } t=k; if(n==0)cout<<t; } else if(k==9) { if(t==-1)t=k; if(n)num++; else { cout<<t; for(i=0;i<num+1;i++) cout<<9; } } else { t++; cout<<t; if(num) { for(i=0;i<num;i++)cout<<0; num=0; } t=k%10; if(n==0)cout<<t; } } cout<<endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator