結果

問題 No.554 recurrence formula
ユーザー jamadjamad
提出日時 2017-08-22 04:56:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 227 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 743,084 KB
最終ジャッジ日時 2024-04-23 01:49:12
合計ジャッジ時間 5,760 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
17,824 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 27 ms
10,752 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 26 ms
10,752 KB
testcase_06 AC 25 ms
10,752 KB
testcase_07 AC 26 ms
10,752 KB
testcase_08 AC 26 ms
10,752 KB
testcase_09 AC 24 ms
10,752 KB
testcase_10 AC 32 ms
12,032 KB
testcase_11 AC 87 ms
25,728 KB
testcase_12 AC 69 ms
21,376 KB
testcase_13 AC 226 ms
61,440 KB
testcase_14 AC 85 ms
25,600 KB
testcase_15 AC 258 ms
71,424 KB
testcase_16 AC 322 ms
85,120 KB
testcase_17 AC 161 ms
44,800 KB
testcase_18 AC 137 ms
38,144 KB
testcase_19 MLE -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())

R={1:1,2:2,3:6,4:28}

def f(x):
    if x==1:return 1
    if x<=3:k=R[x-1]
    else:k=R[x-2]//(x-2)+R[x-1]
        
    R[x]=k*x
    return R[x]


for i in range(1,n):f(i)
#    print(i,f(i))
print(f(n)%(10**9+7))
0