結果
| 問題 |
No.554 recurrence formula
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2017-08-11 23:07:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 48 ms / 2,000 ms |
| コード長 | 262 bytes |
| コンパイル時間 | 1,966 ms |
| コンパイル使用メモリ | 192,416 KB |
| 最終ジャッジ日時 | 2025-01-05 02:14:42 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
#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<<(n<3 ? n : a)<<endl;
}
hogeover30