About Self-describingSequence ¶
์๋ก๋ชฌ ๊ณจ๋กฑ(Solomon Golomb)์ ์๊ธฐ๊ธฐ์ ์์ด <f(1), f(2), f(3), ... >์ ๊ฐ k์ ๋ํด k๋ผ๋ ์ซ์๊ฐ ์ ํํ๊ฒ f(k)๋ฒ ๋ฑ์ฅํ๋ ์์ฑ์ ๊ฐ์ง๋ ์์ ์ ์๋ก ๊ตฌ์ฑ๋ ์ ์ผํ ๋น๊ฐ์์์ด์ด๋ค. ์ด ์์ด์ ์ ๋ถ๋ถ์ ์๊ฐํด๋ณด๋ฉด ๋ค์๊ณผ ๊ฐ์ ์์ด๋ผ๋ ๊ฒ์ ์ ์ ์๋ค.
http://online-judge.uva.es/p/v100/10049img2.gif
์ด๋ค ๊ฐ n์ด ์ฃผ์ด์ก์ ๋ f(n)์ ๊ฐ์ ๊ณ์ฐํ๋ ํ๋ก๊ทธ๋จ์ ๋ง๋ค์ด์ผ ํ๋ค.
http://online-judge.uva.es/p/v100/10049img2.gif
์ด๋ค ๊ฐ n์ด ์ฃผ์ด์ก์ ๋ f(n)์ ๊ฐ์ ๊ณ์ฐํ๋ ํ๋ก๊ทธ๋จ์ ๋ง๋ค์ด์ผ ํ๋ค.
Input ¶
์ฌ๋ฌ ๊ฐ์ ํ
์คํธ ์ผ์ด์ค๊ฐ ์
๋ ฅ๋ ์ ์๋ค. ๊ฐ ์ค๋ง๋ค ํ๋์ฉ์ ์ ์ n์ด ์
๋ ฅ๋๋ฉฐ, ์ ์ ํ ๊ฐ๊ฐ ํ๋์ ํ
์คํธ ์ผ์ด์ค๋ฅผ ์ด๋ฃฌ๋ค(1 โค n โค 2,000,000,000). n์ด 0์ธ ํ
์คํธ ์ผ์ด์ค๊ฐ ์
๋ ฅ๋๋ฉด ์
๋ ฅ์ด ์ข
๋ฃ๋๋ฉฐ, ๊ทธ ์ผ์ด์ค๋ ์ฒ๋ฆฌํ์ง ์๋๋ค.
Output ¶
๊ฐ ํ
์คํธ ์ผ์ด์ค์ ๋ํด ํ ์ค์ ํ๋์ฉ f(n) ๊ฐ์ ์ถ๋ ฅํ๋ค.
Sample Input ¶
{{| 100
9999
123456
1000000000
0 |}}
9999
123456
1000000000
0 |}}
Sample Output ¶
{{| 21
356
1684
438744 |}}
356
1684
438744 |}}
ํ์ด ¶
์์ฑ์ | ์ฌ์ฉ์ธ์ด | ๊ฐ๋ฐ์๊ฐ | ์ฝ๋ |
๋ฌธ๋ณด์ฐฝ | C++ | 2์๊ฐ | Self-describingSequence/๋ฌธ๋ณด์ฐฝ |
ํฉ์ฌ์ | Java | 2์๊ฐ | Self-describingSequence/ํฉ์ฌ์ |
1002 | Python | 1์๊ฐ 40๋ถ | Self-describingSequence/1002 |
shon | matlab | 1์ฐจ : 1์๊ฐ 10๋ถ, 2์ฐจ : 3์๊ฐ | Self-describingSequence/shon |
์กฐํํ | C++ | ? | Self-describingSequence/์กฐํํ |