Logo
(追記) (追記ここまで)

32437번 - Fractions are better when continued 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB30525824288.971%

문제

Little Charles was one of the best competitive programmers in the world. However, he never really liked programming. Now that he is retired, he can dedicate his studies to what he really loves: continued fractions.

To prepare for the upcoming Imensa Competição de Phrações Contínuas (ICPC), he needs to solve the following problem:

Define $p_0 = 1$ as the level 0ドル$ fraction. Then define: $$p_1 = \frac{1}{1+1}$$ as the level 1ドル$ fraction, $p_1$. And also, $$p_2 = \frac{1}{1 + \frac{1}{1+1}}$$ as the level 2ドル$ fraction, $p_2,ドル and so on.

Given an integer value $N,ドル help Charles determine the value of the numerator of the fraction $p_N$.

입력

The first and only line contains an integer $N$ (1ドル ≤ N ≤ 40$).

출력

The value $p_N$ can be written as a fraction of the form $\frac{a}{b},ドル where $a$ and $b$ are coprime. Print a line containing the value of a.

제한

예제 입력 1

2

예제 출력 1

2

예제 입력 2

10

예제 출력 2

89

힌트

출처

ICPC > Regionals > Latin America > Sub-Regional Brasil do ACM ICPC > Maratona de Programação da SBC 2024 F번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /