結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2018-10-24 17:08:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 403 bytes |
コンパイル時間 | 536 ms |
コンパイル使用メモリ | 66,444 KB |
実行使用メモリ | 57,896 KB |
最終ジャッジ日時 | 2024-11-19 05:29:25 |
合計ジャッジ時間 | 1,426 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 2 |
ソースコード
#include <iostream>#include<vector>#include<cmath>using namespace std;const int INF=1e9+7;int N;int main(){cin>>N;vector<vector<int> > dp(N+1,vector<int>(4,0));dp[1][1]=1;for(int i=1;i<N;i++){(dp[i+1][1]+=dp[i][0])%=INF;(dp[i+1][0]+=dp[i][1]+dp[i][2])%=INF;(dp[i+1][2]+=dp[i][1])%=INF;}cout<<(dp[N][0]+dp[N][1]+dp[N][2])%INF<<endl;}