結果
問題 | No.314 ケンケンパ |
ユーザー |
|
提出日時 | 2020-09-11 11:37:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 1,000 ms |
コード長 | 680 bytes |
コンパイル時間 | 1,872 ms |
コンパイル使用メモリ | 167,624 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-12-25 16:10:55 |
合計ジャッジ時間 | 2,605 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define REP(i, n) for (int i = 0; i < n; i++)#define REPR(i, n) for (int i = n; i >= 0; i--)#define FOR(i, m, n) for (int i = m; i < n; i++)#define ALL(v) v.begin(), v.end()#define downque(que) priority_queue<ll> que;#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;typedef long long ll;typedef vector<vector<int>> Matrix;const int MOD = 1e9 + 7;int main(void){int N;cin>>N;vector<ll> dp(N,0);//Use dp, dp[i]=dp[i-2]+dp[i-3];dp[0]=1;dp[1]=2;dp[2]=2;FOR(i,3,N){dp[i]=dp[i-2]+dp[i-3];dp[i]%=MOD;}cout<<dp[N-1]<<endl;return 0;}