結果
問題 |
No.554 recurrence formula
|
ユーザー |
![]() |
提出日時 | 2018-03-20 18:07:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 576 bytes |
コンパイル時間 | 764 ms |
コンパイル使用メモリ | 83,172 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 09:47:33 |
合計ジャッジ時間 | 1,686 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 1 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:29:14: warning: 'a' may be used uninitialized [-Wmaybe-uninitialized] 29 | a[i%2] += (i*a[1-(i%2)])%MOD; | ~~~~~^ main.cpp:25:15: note: 'a' declared here 25 | long long a[2]; | ^
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <limits.h> #include <map> #include <set> #include <queue> #include <algorithm> #include <functional> #include <stdio.h> using namespace std; long long MOD = 1000000007; int main() { long long A[100001] = {0}; int N; cin >> N; A[1] = 1; long long a[2]; a[1] = 1; for ( int i = 2; i < N; i++ ) { a[i%2] += (i*a[1-(i%2)])%MOD; a[i%2] %= MOD; } cout << (N*a[1-(N%2)])%MOD << endl; return 0; }