結果

問題 No.554 recurrence formula
ユーザー 👑 KazunKazun
提出日時 2020-06-12 04:27:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 174 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 76,056 KB
最終ジャッジ日時 2023-09-06 08:54:36
合計ジャッジ時間 3,457 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,336 KB
testcase_01 AC 73 ms
71,144 KB
testcase_02 AC 72 ms
71,288 KB
testcase_03 AC 72 ms
71,352 KB
testcase_04 AC 72 ms
71,524 KB
testcase_05 AC 73 ms
71,548 KB
testcase_06 AC 71 ms
71,140 KB
testcase_07 AC 72 ms
71,452 KB
testcase_08 AC 72 ms
71,344 KB
testcase_09 AC 73 ms
71,376 KB
testcase_10 AC 77 ms
76,036 KB
testcase_11 AC 76 ms
75,868 KB
testcase_12 AC 76 ms
75,872 KB
testcase_13 AC 80 ms
76,056 KB
testcase_14 AC 76 ms
76,036 KB
testcase_15 AC 77 ms
75,968 KB
testcase_16 AC 78 ms
75,924 KB
testcase_17 AC 79 ms
76,008 KB
testcase_18 AC 77 ms
75,952 KB
testcase_19 AC 78 ms
75,964 KB
testcase_20 AC 79 ms
75,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
M=10**9+7

O,E=0,0
T=1

for k in range(2,n+1):
    if k%2:
        E=(E+T)%M
        T=(k*E)%M
    else:
        O=(O+T)%M
        T=(k*O)%M
        
print(T)
0