Решил немного оживить раздел и выложить одну задачку, которую некоторое время назад оформил на одном сайте, но т.к. ссылки давать нельзя, то скопирую ее условие сюда:
Цитата:
Description:
One man (lets call him Eulampy) has a collection of some almost identical Fabergè eggs. One day his friend Tempter said to him:
- Do you see that skyscraper? And can you tell me a maximal floor that if you drop your egg from will not crack it?
- No, - said Eulampy.
- But if you give me N eggs, - says Tempter - I'l tell you an answer.
- Deal - said Eulampy. But I have one requirement before we start this: if I will see more than M falls of egg, my heart will be crushed instead of egg. So you have only M trys to throw an eggs. Would you tell me an exact floor with this limitation?
Task
Your task is to help Tempter - write a function, that takes 2 arguments - amount of eggs N and amount of trys M - and calculate maximum scyscrapper height (in floors), in which it is guaranteed to find an exactly maximal floor from which dropping an egg won't crack an egg.
Examples
heigth 0 14 = 0
heigth 2 0 = 0
heigth 2 14 = 105
heigth 7 20 = 137979
Собственно, все. На сайте с тестирующей системой задача специализирована под язык Haskell, но можете решать на любом - только потребуется длинная арифметика. Очень длинная.