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

Najmaddin Akhundov WA at test#2, please help ! [4] // Problem 1048. Superlong Sums 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;


}
TwoEightNine Goes #STAG [146110 SSAU] Re: WA at test#2, please help ! [1] // Problem 1048. Superlong Sums 16 Oct 2014 16:34
3
1 1
9 0
9 1

try this
this test helped me
Dhruv Somani Re: WA at test#2, please help ! // Problem 1048. Superlong Sums 28 Apr 2016 15:55
My code's producing 300. It's right, isn't it?
ToadMonster Re: WA at test#2, please help ! [1] // Problem 1048. Superlong Sums 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?
abid1729 Re: WA at test#2, please help ! // Problem 1048. Superlong Sums 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];
    }
}