[BOJ 13699] 점화식

View as PDF

Submit solution

Points: 2
Time limit: 5.0s
Memory limit: 512M

Problem type
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

다음의 점화식에 의해 정의된 수열 t(n)을 생각하자:</p>

  • t(0)=1
  • t(n)=t(0)t(n-1)+t(1)t(n-2)+...+t(n-1)*t(0)

이 정의에 따르면,

  • t(1)=t(0)*t(0)=1
  • t(2)=t(0)t(1)+t(1)t(0)=2
  • t(3)=t(0)t(2)+t(1)t(1)+t(2)*t(0)=5
  • ...

주어진 입력 0 ≤ n ≤ 35에 대하여 t(n)을 출력하는 프로그램을 작성하시오.

입력 형식

첫째 줄에 n (0 ≤ n ≤ 35)이 주어진다.

출력 형식

첫째 줄에 t(n)을 출력한다.

예제 입력 1

3

예제 출력 1

5

예제 입력 2

25

예제 출력 2

4861946401452

Comments

There are no comments at the moment.