結果

問題 No.53 悪の漸化式
ユーザー 👑 rin204rin204
提出日時 2022-07-04 15:40:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 235 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 91,016 KB
最終ジャッジ日時 2023-08-20 23:19:19
合計ジャッジ時間 6,560 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 229 ms
88,804 KB
testcase_01 AC 229 ms
88,928 KB
testcase_02 AC 226 ms
88,932 KB
testcase_03 AC 222 ms
89,076 KB
testcase_04 AC 221 ms
88,812 KB
testcase_05 AC 227 ms
88,824 KB
testcase_06 AC 228 ms
88,732 KB
testcase_07 AC 231 ms
88,812 KB
testcase_08 AC 224 ms
88,892 KB
testcase_09 AC 226 ms
89,060 KB
testcase_10 AC 227 ms
88,964 KB
testcase_11 AC 227 ms
89,052 KB
testcase_12 AC 226 ms
88,808 KB
testcase_13 AC 229 ms
88,980 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from decimal import Decimal

n = int(input())
if n == 0:
    print(4)
    exit()
dp = [Decimal(4), Decimal(3)] + [0] * (n - 1)
for i in range(2, n + 1):
    dp[i] = 19 * dp[i - 1] - 12 * dp[i - 2]
    dp[i] /= Decimal(4)
print(dp[n])

0