📄 readme
字号:
Solomon Golomb sequence http://www.programming-challenges.com/pg.php?page=downloadproblem&probid=110607&format=htmlSolomon Golomb's self-describing sequence ( f (1), f (2), f (3),...) 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 moment's thought reveals that the sequence must begin as follows:n 1 2 3 4 5 6 7 8 9 10 11 12f (n) 1 2 2 3 3 4 4 4 5 5 5 6In this problem you are expected to write a program that calculates the value of f (n) given the value of n.InputThe input may contain multiple test cases. Each test case occupies a separate line and contains an integer n ( 1<=$n<=2, 000, 000, 000). The input terminates with a test case containing a value 0 for n and this case must not be processed.OutputFor each test case in the input, output the value of f (n) on a separate line.Sample Input100999912345610000000000Sample Output213561684438744
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -