結果

問題 No.314 ケンケンパ
ユーザー agonybusscla191
提出日時 2018-02-23 15:51:24
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 11 ms / 1,000 ms
コード長 368 bytes
コンパイル時間 1,569 ms
コンパイル使用メモリ 160,212 KB
実行使用メモリ 11,600 KB
最終ジャッジ日時 2024-10-08 06:53:20
合計ジャッジ時間 2,335 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){
        const ll MOD = 1e9 + 7;
        int N;
        cin>>N;
        vector <ll> dp;
        dp.push_back(1);
        dp.push_back(2);
        dp.push_back(2);
        for(int i=3;i<N;i++){
                dp.push_back((dp[i-2]+dp[i-3])%MOD);
        }
        cout<<dp[N-1]<<endl;
}
0