結果

問題 No.53 悪の漸化式
ユーザー rlangevinrlangevin
提出日時 2023-10-27 01:24:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 259 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 80,864 KB
最終ジャッジ日時 2023-10-27 01:24:33
合計ジャッジ時間 3,922 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
79,316 KB
testcase_01 AC 119 ms
79,312 KB
testcase_02 AC 117 ms
79,312 KB
testcase_03 AC 110 ms
79,312 KB
testcase_04 AC 117 ms
79,316 KB
testcase_05 AC 113 ms
79,320 KB
testcase_06 AC 113 ms
79,316 KB
testcase_07 AC 120 ms
79,316 KB
testcase_08 AC 112 ms
79,312 KB
testcase_09 AC 113 ms
79,316 KB
testcase_10 AC 111 ms
79,312 KB
testcase_11 AC 118 ms
79,612 KB
testcase_12 AC 116 ms
79,616 KB
testcase_13 AC 118 ms
79,616 KB
testcase_14 AC 124 ms
79,612 KB
testcase_15 AC 126 ms
80,864 KB
testcase_16 AC 131 ms
80,864 KB
testcase_17 AC 130 ms
80,864 KB
testcase_18 AC 131 ms
80,864 KB
testcase_19 AC 134 ms
80,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from decimal import *

N = int(input())
if N == 0:
    print(4)
elif N == 1:
    print(3)
else:
    a0, a1 = Decimal(4), Decimal(3)
    getcontext().prec = 100
    for i in range(N - 1):
        a2 = (a1 * 19 - 12 * a0)/4
        a1, a0 = a2, a1
    print(a2)
0