結果
問題 |
No.554 recurrence formula
|
ユーザー |
|
提出日時 | 2020-04-20 04:48:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,230 ms / 2,000 ms |
コード長 | 436 bytes |
コンパイル時間 | 627 ms |
コンパイル使用メモリ | 69,816 KB |
実行使用メモリ | 9,112 KB |
最終ジャッジ日時 | 2024-10-06 08:28:50 |
合計ジャッジ時間 | 3,956 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <numeric> using namespace std; using ull = unsigned long long; #define Mod %1000000007 ull a(int n, std::vector<ull>& v) { if (n == 1) return 1; ull am = a(n - 1, v); v.emplace_back(am); for (int i = n - 3; i > 0; i -= 2) am += v[i - 1]; return n * (am Mod); } int main() { int n; cin >> n; std::vector<ull> v; cout << a(n, v)Mod << endl; return 0; }