結果
問題 |
No.554 recurrence formula
|
ユーザー |
![]() |
提出日時 | 2017-08-11 23:03:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 494 bytes |
コンパイル時間 | 606 ms |
コンパイル使用メモリ | 67,080 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-10-12 21:42:53 |
合計ジャッジ時間 | 4,645 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 9 TLE * 1 -- * 1 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <math.h> using namespace std; int main() { int n,p = 1000000007; cin >> n; vector<int> a; a.push_back(0); a.push_back(1); a.push_back(2); for(int i = 3;i <= n;i++){ int b = 0; for(int j = i%2+1;j < i;j+=2){ b += a[j]; b %= p; } b *= i; b %= p; a.push_back(b); } cout << a[n] << endl; return 0; }