結果
| 問題 |
No.314 ケンケンパ
|
| コンテスト | |
| ユーザー |
furu_tuww
|
| 提出日時 | 2016-07-09 23:48:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 1,000 ms |
| コード長 | 496 bytes |
| コンパイル時間 | 657 ms |
| コンパイル使用メモリ | 56,928 KB |
| 実行使用メモリ | 67,524 KB |
| 最終ジャッジ日時 | 2024-10-13 09:47:23 |
| 合計ジャッジ時間 | 1,383 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int n;
int dp[2][2][1111111];
int solve(int a,int b,int k){
if(dp[a][b][k] >= 0) return dp[a][b][k];
if(k >= n) return 1;
int ret = 0;
if(a || b){
ret += solve(b,0,k+1);
ret %= 1000000007;
}
if(!b){
ret += solve(b,1,k+1);
ret %= 1000000007;
}
return dp[a][b][k] = ret;
}
int main(void){
cin >> n;
memset(dp,-1,sizeof(dp));
cout << solve(1,1,0) << endl;
}
furu_tuww