結果

問題 No.554 recurrence formula
ユーザー hogeover30
提出日時 2017-08-11 23:05:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 250 bytes
コンパイル時間 2,046 ms
コンパイル使用メモリ 191,684 KB
最終ジャッジ日時 2025-01-05 02:14:28
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n; cin>>n;

    const int mod=1e9+7;
    long s[2]={2, 1};
    long a=0;
    for(int i=3; i<=n; ++i) {
        a=i*s[1-i%2]%mod;
        (s[i%2]+=a)%=mod;
    }
    cout<<a<<endl;
}
0