시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 347 144 109 44.490%

문제

도현이는 수학 숙제를 하고 있다. 문제는 다음과 같다.

다음과 같이 재귀적으로 정의된 수열이 있다.

\(x_0 = 1\)

\(x_i = x_{\lfloor i - \sqrt{i} \rfloor} + x_{\lfloor \ln{(i)} \rfloor} + x_{\lfloor i \sin^{2}{(i)} \rfloor}\)

이 때, \(x_{1000000}\)을 구하시오.

\(i\)가 주어졌을 때, \(x_i\)를 구하는 프로그램을 작성하시오.

입력

입력은 여러 개의 테스트 케이스로 이루어져 있으며, 한 줄에 하나씩 주어진다.

각 줄에는 \(i\)가 주어지며, 이 수는 0보다 작지 않고, 백만보다 크지 않다.

입력의 마지막 줄에는 -1이 주어지며, 이 수는 입력의 마지막을 나타내는 수이다.

출력

입력으로 주어진 \(i\)마다 \(x_i\)를 1000000로 나눈 나머지를 출력한다.

예제 입력 1

0
-1

예제 출력 1

1
W3sicHJvYmxlbV9pZCI6IjQxNzIiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJzcXJ0IGxvZyBzaW4iLCJkZXNjcmlwdGlvbiI6IjxwPlx1YjNjNFx1ZDYwNFx1Yzc3NFx1YjI5NCBcdWMyMThcdWQ1NTkgXHVjMjE5XHVjODFjXHViOTdjIFx1ZDU1OFx1YWNlMCBcdWM3ODhcdWIyZTQuIFx1YmIzOFx1YzgxY1x1YjI5NCBcdWIyZTRcdWM3NGNcdWFjZmMgXHVhYzE5XHViMmU0LjxcL3A+XHJcblxyXG48cD5cdWIyZTRcdWM3NGNcdWFjZmMgXHVhYzE5XHVjNzc0IFx1YzdhY1x1YWRjMFx1YzgwMVx1YzczY1x1Yjg1YyBcdWM4MTVcdWM3NThcdWI0MWMgXHVjMjE4XHVjNWY0XHVjNzc0IFx1Yzc4OFx1YjJlNC48XC9wPlxyXG5cclxuPHA+XFwoeF8wID0gMVxcKTxcL3A+XHJcblxyXG48cD5cXCh4X2kgPSB4X3tcXGxm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cbGZsb29yIGkgXFxzaW5eezJ9eyhpKX0gXFxyZmxvb3J9XFwpPFwvcD5cclxuXHJcbjxwPkRldGVybWluZSBcXCh4X3sxMDAwMDAwfVxcKS48XC9wPlxyXG4iLCJpbnB1dCI6IjxwPklucHV0IGNvbnNpc3RzIG9mIGEgbnVtYmVyIG9mIGxpbmVzLCBlYWNoIGNvbnRhaW5pbmcgb25lIGludGVnZXIsIGEgdmFsdWUgb2YgaSwgbm8gbGVzcyB0aGFuIHplcm8gYW5kIG5vIGdyZWF0ZXIgdGhhbiBvbmUgbWlsbGlvbi4gSW5wdXQgaXMgZm9sbG93ZWQgYnkgYSBzaW5nbGUgbGluZSBjb250YWluaW5nIHRoZSBpbnRlZ2VyIC0xLiBUaGlzIGxhc3QgbGluZSBpcyBub3QgYSB2YWx1ZSBvZiBpIGFuZCBzaG91bGQgbm90IGJlIHByb2Nlc3NlZC48XC9wPlxyXG4iLCJvdXRwdXQiOiI8cD5Gb3IgZWFjaCB2YWx1ZSBvZiBpIGluIHRoZSBpbnB1dCAoYnV0IG5vdCB0aGUgZmluYWwgLTEpLCBvdXRwdXQgdGhlIGNvcnJlc3BvbmRpbmcgdmFsdWUgb2YgeGkgbW9kdWxvIDEwMDAwMDAuPFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

Contest > Waterloo's local Programming Contests > 3 October, 2009 E번

  • 문제를 번역한 사람: baekjoon
  • 문제의 오타를 찾은 사람: corea