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

is there anything strange in the test 4?
Posted by somebody 2 Jun 2004 15:47
is there anything strange in the test 1?
Posted by young master 26 Jun 2004 22:31
Re: is there anything strange in the test 1?
Posted by sloboz 28 Jun 2004 18:56
test 4 has only nines as sum and the last one is ten so the previous nines become zeroes.
Re: is there anything strange in the test 1?
Posted by young master 28 Jun 2004 23:05
and the test1?
it should not be 4750 right
Re: is there anything strange in the test 1?
Posted by Gheorghe Stefan 29 Jun 2004 03:58
4
0 4
4 2
6 8
3 7

-> 4750 alright...
Re: is there anything strange in the test 1?
Posted by young master 29 Jun 2004 20:12
what's test1,i really want to know
Re: is there anything strange in the test 1?
Posted by Gheorghe Stefan 29 Jun 2004 23:26
that was test 1 :)
my prog,output 4750 but got wa in test 1,i really dont know why
Posted by young master 30 Jun 2004 08:08
#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;i+=2)
    {
        latter=a[i+2]+a[i+3];
        if(n>=2)
        {
            if(latter<10)
            {
                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;
                }
        }
        }
        else
           cout<<former<<endl;
    }
    return 0;
}
Re: my prog,output 4750 but got wa in test 1,i really dont know why
Posted by Vladimir Yakovlev (USU) 30 Jun 2004 18:26
Looks very strange: your program gives different answers on 1st test on different compilers! Right answer - only if compiled with C++Builder.
This trouble is also well known (+)
Posted by Dmitry 'Diman_YES' Kovalioff 30 Jun 2004 22:55
First time I've faced it when the student on the olympiad compiled his text with Visual C++ 6.0, and Delta Checker (my system of checking) - with C++ Builder 6.0. The answers were different. More over, this things may happen in the following cases:
- different compilers
- different operating systems (i.e. W98 and W2000)
- the hidden error in program - i.e. some kind of access violation or overflow - take it also into consideration...
Re: This trouble is also well known (+)
Posted by young master 1 Jul 2004 10:20
ft...it's really hard to imagine...
im not very familiar with such usage "vector<long> a(0);"
so wondering whether it's correct though it looks correct in my local VC++6.0
i know this sort of datas is not legal right
4
1 9
5 5
4 3
1 3
Re: This trouble is also well known (+)
Posted by dpk 11 Aug 2004 11:43
4
5 4
4 5
4 5
5 5
is it output 10000?
but i also get WA at test4!
help me
quoting: "the length of their sum does not exceed N. "
Posted by Vlad Veselov [PMG17, Vinnitsa - KNU, Kiev] 11 Aug 2004 16:25
Re: quoting: "the length of their sum does not exceed N. "
Posted by watchsun 6 Oct 2004 11:52
Is it form the first or the last?
9000+1000=0000 or 1000??
Tell me ! And what was the reason of Crash?
the problem statement says that there can be no test with correct sum being longer than N symbols (-)
Posted by Michael Rybak (accepted@ukr.net) 6 Oct 2004 14:52