結果

問題 No.554 recurrence formula
ユーザー URechaRechaURechaRecha
提出日時 2019-09-06 09:35:07
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 303 bytes
コンパイル時間 888 ms
コンパイル使用メモリ 86,820 KB
実行使用メモリ 266,540 KB
最終ジャッジ日時 2023-09-05 19:39:53
合計ジャッジ時間 6,595 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,324 KB
testcase_01 AC 75 ms
71,356 KB
testcase_02 AC 73 ms
71,168 KB
testcase_03 AC 76 ms
71,336 KB
testcase_04 AC 75 ms
71,060 KB
testcase_05 AC 75 ms
71,356 KB
testcase_06 AC 74 ms
71,248 KB
testcase_07 AC 75 ms
71,180 KB
testcase_08 AC 73 ms
71,500 KB
testcase_09 AC 73 ms
71,340 KB
testcase_10 AC 76 ms
71,168 KB
testcase_11 AC 91 ms
75,904 KB
testcase_12 AC 86 ms
75,908 KB
testcase_13 AC 111 ms
76,092 KB
testcase_14 AC 88 ms
75,888 KB
testcase_15 AC 114 ms
76,008 KB
testcase_16 AC 124 ms
75,940 KB
testcase_17 AC 102 ms
75,832 KB
testcase_18 AC 96 ms
76,040 KB
testcase_19 TLE -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n= int(input())
    dp=[[2,2],[1,1]]
    for i in range(3,n+1,2):
        dp[1][0]=i *dp[0][1]
        dp[1][1]+=dp[1][0]
        dp[0][0]=(i+1) * dp[1][1]
        dp[0][1]+=dp[0][0]
    if n%2 == 0:
        num = dp[0][0]
    else:
        num = dp[1][0]
    print(num%(7+10**9))
main()
0