結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2018-11-24 04:15:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 463 bytes |
コンパイル時間 | 576 ms |
コンパイル使用メモリ | 53,564 KB |
最終ジャッジ日時 | 2025-03-26 16:22:04 |
合計ジャッジ時間 | 1,423 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:4:1: error: ‘uint64_t’ does not name a type 4 | uint64_t dp[1000010][3]; | ^~~~~~~~ main.cpp:2:1: note: ‘uint64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? 1 | #include <iostream> +++ |+#include <cstdint> 2 | using namespace std; main.cpp:5:7: error: ‘uint64_t’ does not name a type 5 | const uint64_t mod = 1000000007; | ^~~~~~~~ main.cpp:5:7: note: ‘uint64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? main.cpp: In function ‘int main()’: main.cpp:12:5: error: ‘dp’ was not declared in this scope 12 | dp[0][i] = 0; | ^~ main.cpp:15:3: error: ‘dp’ was not declared in this scope 15 | dp[1][0] = dp[1][2] = 0; | ^~ main.cpp:19:44: error: ‘mod’ was not declared in this scope 19 | dp[i + 1][0] = (dp[i][1] + dp[i][2]) % mod; | ^~~ main.cpp:24:46: error: ‘mod’ was not declared in this scope 24 | cout << (dp[n][0] + dp[n][1] + dp[n][2]) % mod << endl; | ^~~
ソースコード
#include <iostream>using namespace std;uint64_t dp[1000010][3];const uint64_t mod = 1000000007;int main() {int n;cin >> n;for (int i = 0; i < 3; i++) {dp[0][i] = 0;}dp[1][0] = dp[1][2] = 0;dp[1][1] = 1;for (int i = 1; i < n; i++) {dp[i + 1][0] = (dp[i][1] + dp[i][2]) % mod;dp[i + 1][1] = dp[i][0] % mod;dp[i + 1][2] = dp[i][1] % mod;}cout << (dp[n][0] + dp[n][1] + dp[n][2]) % mod << endl;return 0;}