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

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

what does the output limit mean?
Послано young master 13 июл 2004 13:08
Problem Language Status Test # Time Worked Memory Used
1048 C++ Output Limit Exceeded 2 0.609 269 КБ
It means that your program writes too many data...
Послано Vlad Veselov [PMG17, Vinnitsa - KNU, Kiev] 13 июл 2004 13:34
many thanks,vlad
Послано young master 14 июл 2004 15:13
well,i've really tried hard to look for the existing faults,
but found nothing...amazing~
such as this test data
4
1 9
4 5
4 5
5 5
my prog will output 1000
is it right?
any kind-hearted friend could help this hopeless student
would be appreciated very very much...anyone can help me to do some test?

#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-3;i+=2)
    {
        latter=a[i+2]+a[i+3];
        if(n>=2)
        {
            if(latter<10)
            {
                if(i+3==2*n-1)
                {
                       cout<<latter;
                    break;
                }
                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;
                    if(i+3==2*n-1)
                    {
                        cout<<latter%10;
                        break;
                    }
                }
            }
        }
        else
           cout<<former%10<<endl;
    }
    cout<<endl;
    return 0;
}

Re: many thanks,vlad
Послано Gheorghe Stefan 14 июл 2004 18:16
answer is 1100 I think...
you can find tests on timustests.4t.com but this problem is easy, just count the 9 and 0 ant output them when sum >= 10 (or something :)
Re: many thanks,vlad
Послано young master 14 июл 2004 19:46
oh,thanks for your beautiful advice,but i still cant get on the net of timustests.4t.com
it's said it's needed a proxy?how can i get on?