結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2018-10-24 17:12:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 94 ms / 1,000 ms |
コード長 | 435 bytes |
コンパイル時間 | 604 ms |
コンパイル使用メモリ | 66,420 KB |
実行使用メモリ | 73,432 KB |
最終ジャッジ日時 | 2024-11-19 05:29:29 |
合計ジャッジ時間 | 1,640 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <iostream> #include<vector> #include<cmath> using namespace std; #define int long long const int INF=1e9+7; int N; signed 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])%INF+dp[N][2])%INF<<endl; }