|Online MIPT programming contest||РУССКИЙ|
Time limit = 2 secondsSolomon Golomb's self-describing sequence is the only non-decreasing sequence of positive integers with the property that it contains exactly f(k) occurrences of k for each k. A few moments thought reveals that the sequence must begin as follows:
In this problem you are expected to write a program that calculates the value of f(n) given the value of n.
Input One line with an integer n (1 ≤ n ≤ 2 000 000 000 ).
Output Output the value of f(n).
Miguel Revilla, Valladolid Programming Contest Site
6 September 2003
© acm.mipt DevGroup
The page was generated in 160ms