|
|
back to boardWA on Test#4 Help Please #include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { vector<int> a,b,c; int x=0,sum,val=0; long int n; int z,v; do { cin>>n; }while(n==0); for(x=0;x<n;x++) { cin>>z>>v; a.push_back(z); b.push_back(v); } vector<int>::iterator i,j,k; for(x=0,i=a.end(),j=b.end();x<n;x++) { i--;j--; sum=(((*i)+(*j))%10)+val; c.push_back(sum); val = ((*i)+(*j))/10; } for(k=c.end();k!=c.begin();) { k--; cout<<*k; } return 0; } Re: WA on Test#4 Help Please Posted by AlexF 19 Sep 2006 19:46 On the test 3 1 1 9 0 9 1 Your program gives 2100 The right answer is 300. Good Luck! Re: WA on Test#4 Help Please Thank You!!! My solution was accepted. Re: WA on Test#4 Help Please Posted by ruX 30 Dec 2006 03:01 to: AlexF Thanks! |
|
|