|
|
back to boardwhat does the output limit mean? Problem Language Status Test # Time Worked Memory Used 1048 C++ Output Limit Exceeded 2 0.609 269 КБ It means that your program writes too many data... many thanks,vlad well,i've really tried hard to look for the existing faults, but found nothing...amazing~ such as this test data 4 1 9 4 5 4 5 5 5 my prog will output 1000 is it right? any kind-hearted friend could help this hopeless student would be appreciated very very much...anyone can help me to do some test? #include <iostream> #include <vector> using namespace std; int main() { long i,former,latter,n,c,count9=0; vector<long> a(0); cin>>n; for(i=0;i<2*n;i++) { cin>>c; a.push_back(c); } former=a[0]+a[1]; for(i=0;i<2*n-3;i+=2) { latter=a[i+2]+a[i+3]; if(n>=2) { if(latter<10) { if(i+3==2*n-1) { cout<<latter; break; } if(latter==9) { count9++; if(i+3==2*n-1) { cout<<former; while(count9--) cout<<9; } } else if(latter!=9&&count9==0) { cout<<former; former=latter; } else if(latter!=9&&count9>0) { cout<<former; while(count9--) cout<<9; cout<<latter; } } else { if(count9) { if(former==a[0]+a[1]) cout<<(former+1)%10; else cout<<former+1; while(count9--) cout<<0; cout<<latter%10; } else { cout<<former+1; former=latter%10; if(i+3==2*n-1) { cout<<latter%10; break; } } } } else cout<<former%10<<endl; } cout<<endl; return 0; } Re: many thanks,vlad answer is 1100 I think... you can find tests on timustests.4t.com but this problem is easy, just count the 9 and 0 ant output them when sum >= 10 (or something :) Re: many thanks,vlad oh,thanks for your beautiful advice,but i still cant get on the net of timustests.4t.com it's said it's needed a proxy?how can i get on? |
|
|