結果

問題 No.554 recurrence formula
ユーザー takakin
提出日時 2020-05-13 22:45:47
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 321 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-14 15:43:22
合計ジャッジ時間 2,167 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
e,o=0,1
mod=10**9+7
a=1
sig=0
for i in range(2,n+1):
  if sig==0:
    a=i*o
    if a>mod:
      a%=mod
    e+=a
    if e>mod:
      e%=mod
    sig=1
  else:
    a=i*e
    if a>mod:
      a%=mod
    o+=a
    if o>mod:
      o%=mod
    sig=0
  print(a)
0