結果
問題 |
No.554 recurrence formula
|
ユーザー |
|
提出日時 | 2017-11-27 20:04:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 344 bytes |
コンパイル時間 | 289 ms |
コンパイル使用メモリ | 23,040 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-27 11:22:44 |
合計ジャッジ時間 | 1,284 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 WA * 12 |
コンパイルメッセージ
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; 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); }