結果
問題 |
No.554 recurrence formula
|
ユーザー |
|
提出日時 | 2020-11-04 06:27:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 645 bytes |
コンパイル時間 | 834 ms |
コンパイル使用メモリ | 93,176 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-22 09:43:30 |
合計ジャッジ時間 | 1,762 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include <iostream> #include <string> #include <algorithm> #include <iostream> #include <string> #include <algorithm> #include <vector> #include <iomanip> #include <cmath> #include <stdio.h> #include <queue> #include <deque> #include <cstdio> #include <set> #include <map> #include <bitset> #include <stack> #include <cctype> using namespace std; int main() { int n; cin >> n; long long g = 0, k = 1; long long a = 1; for (int i = 2; i <= n; i++) { if (i % 2 == 0) { a = k * i; a %= 1000000007; g += a; g %= 1000000007; } else { a = g * i; a %= 1000000007; k += a; k %= 1000000007; } } cout << a << endl; }