結果

問題 No.44 DPなすごろく
ユーザー kawacchu
提出日時 2019-11-13 09:36:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 287 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 194,160 KB
最終ジャッジ日時 2025-01-08 03:56:41
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vector<int64_t > a(n+1, 0);
    a[0] = 1;
    a[1] = 1;
    for (int64_t i = 2; i < n+1; i++) a[i] = a[i-1] + a[i-2];
    cout << a[n] << endl;
}
0