結果
| 問題 |
No.314 ケンケンパ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-31 20:13:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 511 bytes |
| コンパイル時間 | 324 ms |
| コンパイル使用メモリ | 31,360 KB |
| 実行使用メモリ | 50,048 KB |
| 最終ジャッジ日時 | 2024-12-29 23:51:30 |
| 合計ジャッジ時間 | 1,848 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 11 |
コンパイルメッセージ
main.cpp: In function 'long long int solve(int, int)':
main.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
29 | }
| ^
ソースコード
#include <stdio.h>
#include <string.h>
using namespace std;
int N;
long long solve(int i, int j);
long long dp[1000010][3];
int main(void){
scanf("%d", &N);
memset(dp, -1, sizeof(dp));
printf("%lld\n", solve(0, 0) % (1000000007));
}
long long solve(int i, int j){
if(i == N) return 1;
if(dp[i][j] != -1) return dp[i][j];
if(j == 0){
return dp[i][j] = solve(i+1, 1);
}else if(j == 1){
return dp[i][j] = (solve(i+1, 0) + solve(i+1, 2));
}else if(j == 2){
return dp[i][j] = solve(i+1, 0);
}
}