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

Общий форум

To MadPsyentist/Sam (1036) (+)
Послано Algorist 7 мар 2002 14:52
How do you use only 2x500 numbers???
Re: To MadPsyentist/Sam (1036) (+)
Послано Sam Green 7 мар 2002 15:15
In order to know how many d digits numbers which their sum is s, you
just have to know how many d-1 digits numbers which their sums are
s , s-1, s-2...s-9 , right?
Yes, of course. But(+)
Послано Algorist 7 мар 2002 16:52
Yes, this is how I solve the problem-> using DP, i count these cases.
But, I have to use long numbers. And there are two variants :
1) To have an array NxS of long numbers to store the possibilities
2) To use just recursion and not to remember anything.
But, bot cases are impossible. Because, the first will get Memory
Limit, the second- Time Limit. So, I tried to allocate memory
dinamically. However, timus (as well as my PC) does not work all
right with realloc() (in C). So, I cannot solve it that way. My
quesiton is, how do you manage to solve the problem with a 2x500
array???

10x in advance
Re: Yes, of course. But(+)
Послано Sam Green 7 мар 2002 18:25
You don't have to store all NxS.
All you have to store is S bignums for current d and another S for d-1.
And current d will be d-1 to next d (i.e. d+1)

should i show you pseudo code ?
Yes, I am so stupid :)) It's obvious, and the same is for Stones, Metro, etc :))
Послано Algorist 7 мар 2002 18:27
(+)
Послано Sam Green 7 мар 2002 19:24
"Ha ha , how could a stupid person solved many problems that I can't :)"
i don't want to say like this , it's like chatting
because this board mainly for questions and answers
... anyway , :)