結果
| 問題 |
No.314 ケンケンパ
|
| ユーザー |
KoshStorm
|
| 提出日時 | 2017-12-18 01:17:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 955 bytes |
| コンパイル時間 | 2,203 ms |
| コンパイル使用メモリ | 170,132 KB |
| 実行使用メモリ | 57,984 KB |
| 最終ジャッジ日時 | 2024-12-15 23:34:22 |
| 合計ジャッジ時間 | 3,265 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 11 |
ソースコード
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define dump1d_arr(array,i) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl;
#define dump2d_arr(array,i,j) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl;
#define dump(x) cerr << #x << " => " << (x) << endl;
#define CLR(vec) { REP(i,vec.size()) vec[i] = 0; }
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define loINF (long)10000000000
#define shINF (short)10000
using namespace std;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
const LL mod = 1e9 + 7;
int main(void){
long N;
cin >> N;
VVL dp(N+1, VL(3,0));
dp[1][1] = 1;
FOR(i,2,N+1){
REP(j,3){
if (j == 0) dp[i][j] = dp[i-1][1] + dp[i-1][2];
else { dp[i][j] = dp[i-1][j-1];}
}
}
cout << ((dp[N][0] + dp[N][1] + dp[N][2]) % mod) << endl;
return 0;
}
KoshStorm