結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2018-09-14 22:30:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 1,000 ms |
コード長 | 360 bytes |
コンパイル時間 | 195 ms |
コンパイル使用メモリ | 22,912 KB |
実行使用メモリ | 9,400 KB |
最終ジャッジ日時 | 2024-07-06 11:39:31 |
合計ジャッジ時間 | 744 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d", &n); | ~~~~~^~~~~~~~~~
ソースコード
#include <stdio.h>int f[1000010][2] = {};int main() {int mod = 1000000000 + 7;int n;scanf("%d", &n);f[1][0] = 1; f[1][1] = 0;f[2][0] = 1; f[2][1] = 1;int i;for (i = 3; i <= n; i++) {f[i][0] = (f[i - 1][1] + f[i - 2][1]) % mod;f[i][1] = f[i - 1][0];}printf("%d", (f[n][0] + f[n][1]) % mod);getchar(); getchar();return 0;}