結果

問題 No.53 悪の漸化式
ユーザー nebukuro09nebukuro09
提出日時 2016-09-05 17:11:15
言語 Python2
(2.7.18)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 220 bytes
コンパイル時間 70 ms
コンパイル使用メモリ 6,608 KB
実行使用メモリ 7,808 KB
最終ジャッジ日時 2023-08-09 22:21:48
合計ジャッジ時間 1,992 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
7,768 KB
testcase_01 AC 22 ms
7,768 KB
testcase_02 AC 23 ms
7,608 KB
testcase_03 AC 23 ms
7,808 KB
testcase_04 AC 23 ms
7,600 KB
testcase_05 AC 22 ms
7,808 KB
testcase_06 AC 22 ms
7,660 KB
testcase_07 AC 23 ms
7,772 KB
testcase_08 AC 22 ms
7,664 KB
testcase_09 AC 24 ms
7,652 KB
testcase_10 AC 23 ms
7,604 KB
testcase_11 AC 23 ms
7,636 KB
testcase_12 AC 23 ms
7,808 KB
testcase_13 AC 23 ms
7,624 KB
testcase_14 AC 23 ms
7,776 KB
testcase_15 AC 24 ms
7,756 KB
testcase_16 AC 24 ms
7,664 KB
testcase_17 AC 25 ms
7,664 KB
testcase_18 AC 26 ms
7,724 KB
testcase_19 AC 26 ms
7,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from fractions import Fraction as F
f = lambda x,y:F(19, 4)*y-F(3*x)
ans = [0 for i in xrange(105)]
ans[0] = F(4)
ans[1] = F(3)
N = input()
for i in xrange(2, N+1):
    ans[i] = f(ans[i-2], ans[i-1])
print float(ans[N])
0