ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1048. Superlong Sums

WA on Test#4 Help Please
Posted by Julius Canute 19 Sep 2006 08:07
#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
Posted by Julius Canute 20 Sep 2006 07:06
Thank You!!!
My solution was accepted.
Re: WA on Test#4 Help Please
Posted by ruX 30 Dec 2006 03:01
to: AlexF
Thanks!