結果

問題 No.554 recurrence formula
ユーザー jamadjamad
提出日時 2017-08-22 04:03:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 282 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,836 KB
最終ジャッジ日時 2024-04-23 01:47:40
合計ジャッジ時間 15,310 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
17,692 KB
testcase_01 AC 32 ms
10,752 KB
testcase_02 AC 35 ms
10,752 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 32 ms
10,880 KB
testcase_05 AC 29 ms
10,752 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 30 ms
10,880 KB
testcase_09 AC 29 ms
10,752 KB
testcase_10 AC 88 ms
10,880 KB
testcase_11 AC 617 ms
11,136 KB
testcase_12 AC 454 ms
11,264 KB
testcase_13 AC 1,906 ms
11,520 KB
testcase_14 AC 620 ms
11,264 KB
testcase_15 TLE -
testcase_16 TLE -
testcase_17 AC 1,315 ms
11,648 KB
testcase_18 AC 1,071 ms
11,776 KB
testcase_19 TLE -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())

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

def f(x):
    if x==1:return R[1]
    k=0
    if x%2==0:
        for y in range(1,x,2):k+=R[y]
    else:
        for y in range(2,x,2):k+=R[y]
    R[x]=k*x%(10**9+7)
    return R[x]


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