結果
| 問題 | No.554 recurrence formula |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-11-27 20:05:21 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 350 bytes |
| 記録 | |
| コンパイル時間 | 168 ms |
| コンパイル使用メモリ | 23,168 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-27 11:22:45 |
| 合計ジャッジ時間 | 928 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 WA * 11 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
ソースコード
#include<cstdio>
#define MOD 1000000007
int main(void) {
int n;
scanf("%d",&n);
int e=0, o=1, a=1;
for(int i=2; i<=n; i++) {
if(i%2) {
a=i*e % MOD;
o+=a;
o%= MOD;
} else {
a=i*o % MOD;
e+=a;
e%= MOD;
}
}
printf("%d\n", a%MOD);
}