結果

問題 No.53 悪の漸化式
ユーザー lloyzlloyz
提出日時 2022-08-10 01:25:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 283 bytes
コンパイル時間 138 ms
コンパイル使用メモリ 11,880 KB
実行使用メモリ 10,536 KB
最終ジャッジ日時 2023-10-20 10:52:07
合計ジャッジ時間 2,069 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,464 KB
testcase_01 AC 32 ms
10,464 KB
testcase_02 AC 31 ms
10,524 KB
testcase_03 AC 32 ms
10,524 KB
testcase_04 AC 31 ms
10,524 KB
testcase_05 AC 31 ms
10,524 KB
testcase_06 AC 31 ms
10,524 KB
testcase_07 AC 32 ms
10,524 KB
testcase_08 AC 31 ms
10,524 KB
testcase_09 AC 32 ms
10,524 KB
testcase_10 AC 32 ms
10,524 KB
testcase_11 AC 32 ms
10,528 KB
testcase_12 AC 31 ms
10,528 KB
testcase_13 AC 32 ms
10,528 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())
A = [0 for _ in range(n + 1)]

if n == 0:
    print(4.0)
    exit()
if n == 1:
    print(3.0)
    exit()

A[0] = Decimal(4.0)
A[1] = Decimal(3.0)
for i in range(2, n + 1):
    A[i] = Decimal(19 / 4) * A[i - 1] - 3 * A[i - 2]
print(A[n])
0