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

Обсуждение задачи 1108. Наследство

please give me any trick for multiplying bignum ! i got tl and why solution for a(n) is...
Послано TheBlaNK 16 апр 2002 15:27
please give me any trick for multiplying bignum ! i got tl and why
solution for a(n) is...

a(n)=pow(a(n-1),2)-a(n-1)+1;
Mhm....(+)
Послано Miguel Angel 17 апр 2002 01:29
a(n)= a(n-1)^2-a(n-1) + 1

the way to do the problem is very easy, you see, the first fraction
is obviusly the least which is 1/2 then you may want a fraction which
is less than this last one but added with this leads to minimum left,
so you may want a fraction the more likely to 1/2, this is 1/3 (2+1),
then with this to add a third fraction, this will be 1/2 + 1/3 + ?,
could be 1/6, but this leads to get a sum of 1, so the next will be
1/7 (2*3 + 1), the next will be 1/43 (2*3*7 + 1), the formula you put
is a pretty factorization of this.
There's a method to do multiplications on O(n^1.54), but i don't know
how to do it exactly, you may want to see it in a book.
Good Luck :)
Miguel Angel.
miguelangelhdz@hotmail.com
Re: Mhm....(+)
Послано Vlad Ionescu 2 июл 2003 21:33
An easyier way to get AC is to represent the bignums in base 1000.
There is a lot of time saving an the modifications needed to be done
when writing the output are easy (just add some 0s if a[j]<100 and a
[j]<10).
As for the O(N^1.58) algo, you were supposed to split the numbers
into two halfs: A=C*10^n/2+D and B=E*10^n/2+F.
G=(C+D)*(E+F)=C*E+D*F+C*F+D*E
Then A*B=C*E*10^n+(G-C*E-D*F)*10^n/2+D*F
We only hav to do 3 multiplications instead of 4 (G,C*E,D*F). In
order to do these multiplication we use the same algorithm, until
C,E,D,F on have one digit.