ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1048. Сверхдлинные суммы

is there anything strange in the test 4?
Послано somebody 2 июн 2004 15:47
is there anything strange in the test 1?
Послано young master 26 июн 2004 22:31
Re: is there anything strange in the test 1?
Послано sloboz 28 июн 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?
Послано young master 28 июн 2004 23:05
and the test1?
it should not be 4750 right
Re: is there anything strange in the test 1?
Послано Gheorghe Stefan 29 июн 2004 03:58
4
0 4
4 2
6 8
3 7

-> 4750 alright...
Re: is there anything strange in the test 1?
Послано young master 29 июн 2004 20:12
what's test1,i really want to know
Re: is there anything strange in the test 1?
Послано Gheorghe Stefan 29 июн 2004 23:26
that was test 1 :)
my prog,output 4750 but got wa in test 1,i really dont know why
Послано young master 30 июн 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
Послано Vladimir Yakovlev (USU) 30 июн 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 (+)
Послано Dmitry 'Diman_YES' Kovalioff 30 июн 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 (+)
Послано young master 1 июл 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 (+)
Послано dpk 11 авг 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. "
Послано Vlad Veselov [PMG17, Vinnitsa - KNU, Kiev] 11 авг 2004 16:25
Re: quoting: "the length of their sum does not exceed N. "
Послано watchsun 6 окт 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 (-)
Послано Michael Rybak (accepted@ukr.net) 6 окт 2004 14:52