시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 465 213 190 64.846%

문제

피보나치 수열은 다음과 같이 그 전 두 항의 합으로 계산되는 수열이다. 첫 두 항은 1로 정의된다.

f(1) = 1, f(2) = 1, f(n > 2) = f(n − 1) + f(n − 2)

정수를 입력받아, 그에 해당하는 피보나치 수를 출력하는 프로그램을 작성하여라.

입력

출력

예제 입력 1

100

예제 출력 1

354224848179261915075

힌트

해당 테스트 데이터의 모든 정답은 1000자를 넘지 않는다. ( f(20) = 6765 이므로 4자다. )

W3sicHJvYmxlbV9pZCI6IjQxNTAiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQ1M2NcdWJjZjRcdWIwOThcdWNlNTggXHVjMjE4IiwiZGVzY3JpcHRpb24iOiI8cD5cdWQ1M2NcdWJjZjRcdWIwOThcdWNlNTggXHVjMjE4XHVjNWY0XHVjNzQwIFx1YjJlNFx1Yzc0Y1x1YWNmYyBcdWFjMTlcdWM3NzQmbmJzcDtcdWFkZjggXHVjODA0IFx1YjQ1MCBcdWQ1NmRcdWM3NTggXHVkNTY5XHVjNzNjXHViODVjIFx1YWNjNFx1YzBiMFx1YjQxOFx1YjI5NCBcdWMyMThcdWM1ZjRcdWM3NzRcdWIyZTQuIFx1Y2NhYiBcdWI0NTAgXHVkNTZkXHVjNzQwIDFcdWI4NWMgXHVjODE1XHVjNzU4XHViNDFjXHViMmU0LjxcL3A+XHJcblxyXG48cCBzdHlsZT1cInRleHQtYWxpZ246IGNlbnRlcjtcIj5mKDEpID0gMSwgZigyKSA9IDEsIGYobiAmZ3Q7IDIpID0gZihuICZtaW51czsgMSkgKyBmKG4gJm1pbnVzOyAyKTxcL3A+XHJcblxyXG48cD5cdWM4MTVcdWMyMThcdWI5N2MgXHVjNzg1XHViODI1XHViYzFiXHVjNTQ0LCBcdWFkZjhcdWM1ZDAgXHVkNTc0XHViMmY5XHVkNTU4XHViMjk0IFx1ZDUzY1x1YmNmNFx1YjA5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cyBpbnB1dCwgYW5kIHByaW50IHRoYXQgZmlib25hY2NpIG51bWJlci48XC9wPlxyXG4iLCJpbnB1dCI6IiIsIm91dHB1dCI6IiIsImhpbnQiOiI8cD5ObyBnZW5lcmF0ZWQgZmlib25hY2NpIG51bWJlciBpbiBleGNlc3Mgb2YgMTAwMCBkaWdpdHMgd2lsbCBiZSBpbiB0aGUgdGVzdCBkYXRhLCBpLmUuIGYoMjApID0gNjc2NSBoYXMgNCBkaWdpdHMuPFwvcD5cclxuIiwib3JpZ2luYWwiOiIxIiwicHJvYmxlbV9sYW5nX2NvZGUiOiJcdWM2MDFcdWM1YjQifV0=

출처

Contest > Waterloo's local Programming Contests > 19 June, 2011 C번

  • 문제를 번역한 사람: jjwdi0
  • 데이터를 추가한 사람: mystika