結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2018-02-04 23:01:04 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 7 ms / 1,000 ms |
コード長 | 474 bytes |
コンパイル時間 | 1,204 ms |
コンパイル使用メモリ | 157,720 KB |
実行使用メモリ | 12,652 KB |
最終ジャッジ日時 | 2024-06-30 04:05:50 |
合計ジャッジ時間 | 2,149 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include<bits/stdc++.h> #define REP(i,n) for(int i=0;i<n;i++) #define LOOP(i,x,n) for(int i=x;i<n;i++) #define ALL(v) (v).begin(),(v).end() #define PB push_back #define MP make_pair #define FR first #define SC second #define int long long using namespace std; const int MOD=1000000007; const int INF=9000000009; int dp[10000006]; signed main(){ int n; cin>>n; dp[0]=1;dp[1]=2;dp[2]=2; LOOP(i,3,n+1)dp[i]=(dp[i-2]+dp[i-3])%MOD; cout<<dp[n-1]<<endl; return 0; }