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

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

hint : use long int to "count" not to "storing Value" & u'll use only 12k
Послано ss 21 авг 2002 14:25
count the 9!!
:-)
Re: hint : use long int to "count" not to "storing Value" & u'll use only 12k
Послано GodZilla 21 авг 2002 15:49
> count the 9!!
> :-)
Tell me more about it !!!! PLEASE !!!!
Re: hint : use long int to "count" not to "storing Value" & u'll use only 12k
Послано ss 21 авг 2002 19:20
more hint :

0 1 -> 1 wait
2 3-> 5 wait print 1
3 4-> 7 wait print 5

0 1 ->1  wait
4 5 -> 9 #1 wait print 1
4 5 ->9 #2 wait
4 5 -> 9 #3  wait
2 2 ->4  <- now- print '9' for 3

0 1 ->1 ->print!
4 5 -> 9 #1 wait
4 5 ->9 #2 wait
4 5 -> 9 #3  wait
5 5 ->10  <- now- print '0' for 3

godd lucK :-)

sorry ,the above is wrong here's the other one
Послано ss 21 авг 2002 19:24
(1)
0 1 -> 1 wait
2 3-> 5 wait print 1
3 4-> 7 wait print 5
.
.
(2)
0 1 ->1  wait
4 5 -> 9 #1 wait
4 5 ->9 #2 wait
4 5 -> 9 #3  wait
2 2 ->4  wait  <- now- printf '1' & print '9' for 3
.
.
(3)
0 1 ->1 wait
4 5 -> 9 #1 wait
4 5 ->9 #2 wait
4 5 -> 9 #3  wait
5 5 ->10  wait <- now- printf 1+1=2 & print '0' for 3
.
.
.
good lucK :-)
But I still don't understand !!
Послано GodZilla 22 авг 2002 16:27
> (1)
> 0 1 -> 1 wait
> 2 3-> 5 wait print 1
> 3 4-> 7 wait print 5
> .
> .
> (2)
> 0 1 ->1  wait
> 4 5 -> 9 #1 wait
> 4 5 ->9 #2 wait
> 4 5 -> 9 #3  wait
> 2 2 ->4  wait  <- now- printf '1' & print '9' for 3
> .
> .
> (3)
> 0 1 ->1 wait
> 4 5 -> 9 #1 wait
> 4 5 ->9 #2 wait
> 4 5 -> 9 #3  wait
> 5 5 ->10  wait <- now- printf 1+1=2 & print '0' for 3
> .
> .
> .
> good lucK :-)
>
>
it means:
Послано ss 22 авг 2002 19:48
u can print  the sum of the number you're reading now when you've found
the sum after them !=9 if the sum after them ==9 just count it ......
1.when you've read the sum<9 print  all the number BEFORE  them then
start reading again and the last sum you've made become the firt one
2.when ugot sum>9 print the first one+! and all the nine-->0 the now the
first one is the last sum%10 got it? the main idea is u can stored the
number  in the way x 9 9 9 9 ..... but just remember the first one ans
COUNT the nine..........

sorry for my eng...
Re: it means:
Послано GodZilla 25 авг 2002 13:50

 Thank you !!!
If you want to make a  friend, mail me: Devil_hunter@mail.ru
but...
Послано let 12 апр 2004 18:48
but it may not work if the sum of every line is 9....

4 5 -> 9 wait
4 5 -> 9 #1wait
4 5 -> 9 #2wait
4 5 -> 9 #3wait
. . .  .    .
. . .  .    .
. . .  .    .
4 5-> 9 #999999wait
1 3-> than printf

if input just like this,how to solve it??
Re: but...
Послано sloboz 13 апр 2004 05:26
you count the nines and the zeroes. If current sum is larger than 10 you print the zeroes from the "buffer" otherwise you print the nines.
If you want a source code... nah, better not.
Data size: only 20 bytes.
Послано Vlad Veselov 13 апр 2004 19:11
Re: it means:
Послано young master 22 июн 2004 20:38
i did it according to your methods but still got WA even in the very first test1...ft...
but every test datas i could see are all made to be used into my local IDE and turned out to be correct...
why? i really dunno...ft...again...
any help would be appreciated as deeply as possible...
Re: it means:
Послано young master 22 июн 2004 20:39
//here's my prog...
#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)
                {
                    cout<<former+1;
                    while(count9--)
                       cout<<0;
                    cout<<latter%10;
                }
                else
                {
                       cout<<former+1;
                    former=latter%10;
                }
        }
        }
        else
           cout<<former<<endl;
    }
    return 0;
}