結果

問題 No.554 recurrence formula
ユーザー URechaRechaURechaRecha
提出日時 2019-09-06 09:35:11
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 303 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 266,392 KB
最終ジャッジ日時 2023-09-05 19:40:02
合計ジャッジ時間 5,857 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
75,708 KB
testcase_01 AC 71 ms
71,252 KB
testcase_02 AC 73 ms
71,424 KB
testcase_03 AC 71 ms
71,044 KB
testcase_04 AC 72 ms
71,324 KB
testcase_05 AC 73 ms
71,068 KB
testcase_06 AC 74 ms
71,324 KB
testcase_07 AC 72 ms
71,424 KB
testcase_08 AC 74 ms
71,332 KB
testcase_09 AC 73 ms
71,104 KB
testcase_10 AC 77 ms
71,040 KB
testcase_11 AC 92 ms
75,900 KB
testcase_12 AC 87 ms
76,096 KB
testcase_13 AC 116 ms
76,400 KB
testcase_14 AC 93 ms
76,112 KB
testcase_15 AC 117 ms
76,016 KB
testcase_16 AC 128 ms
76,100 KB
testcase_17 AC 103 ms
76,088 KB
testcase_18 AC 98 ms
76,020 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