結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2020-09-30 20:45:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 77 ms / 1,000 ms |
コード長 | 454 bytes |
コンパイル時間 | 1,406 ms |
コンパイル使用メモリ | 170,564 KB |
実行使用メモリ | 57,932 KB |
最終ジャッジ日時 | 2024-07-06 11:19:22 |
合計ジャッジ時間 | 2,552 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define INF 1000000000000000000#define MOD 1000000007using ll=long long;using Graph=vector<vector<int>>;int main(){int N;cin>>N;vector<vector<ll>> dp(N,vector<ll>(3,0));dp[0][1]=1;for(int i=1;i<N;i++){dp[i][0]=dp[i-1][1]+dp[i-1][2];dp[i][0]%=MOD;dp[i][1]=dp[i-1][0];dp[i][2]=dp[i-1][1];}ll ans=dp[N-1][0]+dp[N-1][1]+dp[N-1][2];ans%=MOD;cout<<ans<<endl;}