結果

問題 No.554 recurrence formula
ユーザー kohei2019kohei2019
提出日時 2022-02-09 20:25:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 171 bytes
コンパイル時間 1,330 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 88,544 KB
最終ジャッジ日時 2023-09-07 06:08:08
合計ジャッジ時間 4,396 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,228 KB
testcase_01 AC 74 ms
71,328 KB
testcase_02 AC 73 ms
71,272 KB
testcase_03 AC 73 ms
71,244 KB
testcase_04 AC 72 ms
71,396 KB
testcase_05 AC 72 ms
71,404 KB
testcase_06 AC 71 ms
71,076 KB
testcase_07 AC 72 ms
71,240 KB
testcase_08 AC 72 ms
71,216 KB
testcase_09 AC 72 ms
71,344 KB
testcase_10 AC 80 ms
76,320 KB
testcase_11 AC 76 ms
76,032 KB
testcase_12 AC 76 ms
75,972 KB
testcase_13 AC 76 ms
76,004 KB
testcase_14 AC 75 ms
76,092 KB
testcase_15 AC 76 ms
76,132 KB
testcase_16 AC 75 ms
75,936 KB
testcase_17 AC 78 ms
76,024 KB
testcase_18 AC 77 ms
76,088 KB
testcase_19 AC 91 ms
88,544 KB
testcase_20 AC 90 ms
88,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
mod = 10**9+7
ls = [0,1]
lssum = [0,1]
for i in range(2,N+1):
    v = lssum[i-1]*i
    ls.append(v%mod)
    lssum.append((lssum[i-2]+v)%mod)
print(ls[-1])
0