結果

問題 No.44 DPなすごろく
ユーザー vjudge1vjudge1
提出日時 2024-02-19 22:30:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,334 bytes
コンパイル時間 2,120 ms
コンパイル使用メモリ 200,520 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-02-19 22:30:29
合計ジャッジ時間 3,175 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

/*
    Author: hoangvu276
    vnoi: https://oj.vnoi.info/user/hoangvu276
    codeforces: https://codeforces.com/profile/Hoangvu276
*/

#include <bits/stdc++.h>
using namespace std;

#define ull unsigned long long
#define int long long
#define FOR(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 el cout << '\n';
#define all(v) (v).begin(),(v).end()
#define pii pair<int,int>
#define p2i pair<int,pii>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//bitmask
#define bitcnt(n) __builtin_popcount(n)
#define mask(i) (1 << (i))
#define bit(n, i) (((n) >> (i)) & 1)
#define set_on(n, i) ((n)  mask(i))
#define set_off(n, i) ((n) & ~mask(i))

const int INF=1e18+9;
const int MOD=1e9+7;
const int MAXN=1e6+5;
const int base=131;
#define HVu 0

int n, dp[55];

void solve(){
    cin >> n;
    dp[0] = dp[1] = 1;
    FOD(i,2,n) dp[i] = dp[i-1] + dp[i-2];
    cout << dp[n];
}

signed main(){
    #define NAME ""
    faster
    if(fopen(NAME".inp", "r")){
        freopen(NAME".inp", "r", stdin);
        freopen(NAME".out", "w", stdout);
    }

    if(HVu){
        int tc; cin >> tc;
        while(tc--){
            solve();
        }
    } else solve();
}

0