結果
問題 |
No.314 ケンケンパ
|
ユーザー |
|
提出日時 | 2018-10-04 22:33:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,038 bytes |
コンパイル時間 | 622 ms |
コンパイル使用メモリ | 83,452 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 12:23:22 |
合計ジャッジ時間 | 2,438 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 2 RE * 5 |
ソースコード
#include <iostream> #include <cctype> #include <algorithm> #include <vector> #include <map> #include <queue> #include <set> #include <stack> #include <utility> #include <string> #include <functional> #include <cctype> #include <cstring> #include <cstdio> #include <cstdlib> #include <cmath> #include <iomanip> #include <bitset> #define pb push_back #define mp make_pair #define YES cout<<"YES"<<endl #define Yes cout<<"Yes"<<endl #define NO cout<<"NO"<<endl #define No cout<<"No"<<endl #define INF (1<<30) #define LLINF (1<<60) #define MOD 1000000007 #define rep(i, n) for(int i=0;i<n;i++) using ll = long long; using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; int dp[10005][3] = {}; dp[1][1] = 1; dp[1][0] = dp[1][2] = 0; for (int i = 2; i <= n; i++) { dp[i][0] = (dp[i - 1][1] + dp[i - 1][2])%MOD; dp[i][1] = dp[i - 1][0]%MOD; dp[i][2] = dp[i - 1][1]%MOD; } cout << (dp[n][0] + dp[n][1] + dp[n][2])%MOD << endl; return 0; }