問題一覧 > 通常問題

No.53 悪の漸化式

レベル : / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-9}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 253
作問者 : LayCurse
お気に入りにしたユーザー ProblemId : 80 / 自分の提出
問題文最終更新日: 2026-06-26 21:44:57
The Evil Recurrence Relation
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
yukicoder contest 45 (順位表) の他の問題:

Problem Statement

Write a program that computes the \(N\)-th term \(A_N\) of the sequence \(\{A_k\}_{k=0}^\infty\) defined by the following recurrence relation.
  \(A_0 = 4,\)
  \(A_1 = 3,\)
  \(4 A_k = 19 A_{k-1} - 12 A_{k-2}, \;\; k \geq 2.\)
    
(Note: This is a tricky problem.)

Input

N

\(0 \leq N \leq 100\)

Output

Print the value of \(A_N\) on \(1\) line.
Your answer is considered correct if the absolute error or the relative error is at most \(10^{-9}\).
It is guaranteed that the absolute value of the answer \(|A_N|\) does not exceed \(10^{50}\).
Print a newline after the answer.

Sample

Sample 1
Input
0
Output
4.00000000
Sample 2
Input
4
Output
1.265625

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。