ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1048. Superlong Sums

Posted by Najmaddin Akhundov 16 Oct 2014 15:20
#include <iostream>
#include <vector>

using namespace std;

int main()
{
int n;
cin >> n;

int a;
int b;
long double c=0;
for (unsigned int i = 0; i < n; i++)
{
cin >> a;
cin >> b;

if (i != 0 )
{
c = c * 10 + a + b;
}
else
c = a + b;

}

cout <<c<< endl;

}
Posted by TwoEightNine Goes #STAG [146110 SSAU] 16 Oct 2014 16:34
3
1 1
9 0
9 1

try this
this test helped me
Posted by Dhruv Somani 28 Apr 2016 15:55
My code's producing 300. It's right, isn't it?
Posted by ToadMonster 28 Apr 2016 16:13
What is double mantissa size? About 17 decimal digits?
What is required number size? About 1,000,000 digits?

So, how your solution is supposed to work?
Posted by abid1729 18 Jul 2019 09:12
//wa on test 2 .. whats the problem with my code
#include<bits/stdc++.h>
using namespace std;
int main()
{
long n,i,j=0;
cin>>n;
int a[2000003],b=0;
string s;
n*=2;
for(i=0;i<n;i++){
cin>>a[i];
}
for(i=n-1;i>=0;i=i-2){
b=(b+a[i]+a[i-1]);
s[j]=(b%10)+48;
b=b/10;
j++;
}
for(i=j-1;i>=0;i--){
cout<<s[i];
}
}