結果
| 問題 | No.314 ケンケンパ |
| コンテスト | |
| ユーザー |
tokkaka
|
| 提出日時 | 2016-07-20 20:19:11 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 782 bytes |
| 記録 | |
| コンパイル時間 | 625 ms |
| コンパイル使用メモリ | 95,248 KB |
| 最終ジャッジ日時 | 2026-05-10 04:27:57 |
| 合計ジャッジ時間 | 1,263 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:20:1: error: 'uint64_t' does not name a type
20 | uint64_t solve(int index, int ken)
| ^~~~~~~~
main.cpp:14:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
13 | #include <iomanip>
+++ |+#include <cstdint>
14 |
main.cpp: In function 'int main()':
main.cpp:43:13: error: 'solve' was not declared in this scope
43 | cout << solve(0, 0) << endl;
| ^~~~~
ソースコード
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <functional>
#include <tuple>
#include <climits>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <iomanip>
using namespace std;
int N;
vector<vector<int>> dp;
uint64_t solve(int index, int ken)
{
if(ken>=3)
return 0;
if(index==N)
return 1;
if(dp[index][ken] != -1)
return dp[index][ken];
uint64_t a=0, b=0;
if(ken!=0)
a = solve(index+1, 0); // パ
b = solve(index+1, ken+1);
dp[index][ken] = (a+b)%(1000000000+7);
return dp[index][ken];
}
int main()
{
cin >> N;
dp.resize(N);
for(auto &a : dp)
a.resize(3,-1);
cout << solve(0, 0) << endl;
}
tokkaka