結果
問題 |
No.554 recurrence formula
|
ユーザー |
|
提出日時 | 2017-09-08 11:05:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 403 bytes |
コンパイル時間 | 1,970 ms |
コンパイル使用メモリ | 193,544 KB |
最終ジャッジ日時 | 2025-01-05 02:41:59 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 WA * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; const int MOD = int(1e9) + 7; int main() { ios::sync_with_stdio(false); int n; cin >> n; int odd = 1, even = 0; for (int i = 2; i <= n; ++i) { if (i & 1) { odd = (odd + 1LL * n * even) % MOD; } else { even = (even + 1LL * n * odd) % MOD; } } if (n & 1) cout << odd << endl; else cout << even << endl; return 0; }