結果

問題 No.44 DPなすごろく
ユーザー vjudge1vjudge1
提出日時 2024-02-19 23:13:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,128 bytes
コンパイル時間 2,170 ms
コンパイル使用メモリ 202,812 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-19 23:13:19
合計ジャッジ時間 2,829 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 1 ms
6,676 KB
testcase_09 AC 1 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 1 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 1 ms
6,676 KB
testcase_22 AC 1 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define NAME ""
#define ll long long
#define F(i,a,b) for(int i=(a);i<(b);++i)
#define fod(i,a,b) for(int i=(a);i<=(b);++i)
#define rep(i,a,b) for(int i=(a);i>=(b);--i)
#define f0(i,n) for(int i=0;i<n;i++)
#define f1(i,n) for(int i=1;i<=n;i++)
#define mii map<int, int>
#define mll map<long long, long long>
#define vi vector<int>
#define vll vector<long long>
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define el "\n"
#define lcm(a, b) (a * b) / __gcd(a, b);
#define ms(f, s) memset(f, s, sizeof(f));
using namespace std;
typedef long double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const long long INF=1e18+9;
const int MOD=1e9+7;
const int MAXN=1e6+5;
void file(){
    freopen(NAME".INP","r",stdin);
    freopen(NAME".OUT","w",stdout);
}

int main(){
    ios_base::sync_with_stdio(0);
     cin.tie(0);cout.tie(0);
      //file();
       int N;
    cin >> N;
    vll dp(N+1, 0);
    dp[0] = dp[1] = 1;
    fod(i,2,N) {
        dp[i] = dp[i-1] + dp[i-2];
    }
    cout << dp[N] << endl;
    return 0;
}
0