結果
問題 | No.554 recurrence formula |
ユーザー |
|
提出日時 | 2017-08-11 23:03:17 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 414 bytes |
コンパイル時間 | 1,760 ms |
コンパイル使用メモリ | 168,116 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-12 21:42:38 |
合計ジャッジ時間 | 2,937 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 11 RE * 4 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long LL;int main() {int n;cin >> n;LL mod = 1000000000 + 7;vector<LL> a(n + 1);a[0] = 1;a[1] = 1;a[2] = 2;a[3] = 6;a[4] = 28;a[5] = 150;for (int i = 6; i <= n; i++) {a[i] = (i % mod * (a[i - 2] / (i - 2) + a[i - 1]) % mod) % mod;}cout << a[n] % mod << endl;return 0;}