結果
| 問題 | No.53 悪の漸化式 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-01 14:32:42 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 144 ms / 5,000 ms |
| コード長 | 307 bytes |
| 記録 | |
| コンパイル時間 | 301 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 84,992 KB |
| 最終ジャッジ日時 | 2026-04-26 06:29:51 |
| 合計ジャッジ時間 | 5,630 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
import decimal
import math
N = int(input())
A = [4,3]
B = [1,1]
for i in range(2,N+1):
a0,b0 = A[i-2],B[i-2]
a1,b1 = A[i-1],B[i-1]
x = 19*a1*b0 - 12*a0*b1
y = b0 * b1 * 4
g = math.gcd(x,y)
x //= g
y //= g
A.append(x)
B.append(y)
print(decimal.Decimal(A[N]/B[N]))