結果

問題 No.53 悪の漸化式
ユーザー nebukuro09nebukuro09
提出日時 2016-09-05 17:11:15
言語 Python2
(2.7.18)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 220 bytes
コンパイル時間 59 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 8,192 KB
最終ジャッジ日時 2024-04-27 16:40:46
合計ジャッジ時間 1,486 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,064 KB
testcase_01 AC 19 ms
8,064 KB
testcase_02 AC 19 ms
8,064 KB
testcase_03 AC 19 ms
8,064 KB
testcase_04 AC 20 ms
8,064 KB
testcase_05 AC 19 ms
8,192 KB
testcase_06 AC 18 ms
8,064 KB
testcase_07 AC 20 ms
8,064 KB
testcase_08 AC 19 ms
8,192 KB
testcase_09 AC 19 ms
8,064 KB
testcase_10 AC 19 ms
8,064 KB
testcase_11 AC 20 ms
8,064 KB
testcase_12 AC 18 ms
8,064 KB
testcase_13 AC 24 ms
8,192 KB
testcase_14 AC 21 ms
8,192 KB
testcase_15 AC 20 ms
8,192 KB
testcase_16 AC 20 ms
8,192 KB
testcase_17 AC 21 ms
8,192 KB
testcase_18 AC 21 ms
8,192 KB
testcase_19 AC 23 ms
8,192 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