結果

問題 No.786 京都大学の過去問
ユーザー pro_rop2pro_rop2
提出日時 2022-02-27 17:42:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 762 bytes
コンパイル時間 1,700 ms
コンパイル使用メモリ 163,936 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-19 05:04:24
合計ジャッジ時間 2,169 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)
template <class T>
inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const long long INF = numeric_limits<long long>::max();
using Graph = vector<vector<int> >;
int main() {
    int n;
    cin >> n;
    ll a[100010];
    rep(i, n) { cin >> a[i]; }
    ll dp[100010];
    dp[0] = 0;
    dp[1] = 1;
    dp[2] = 2;
    rep2(i, 3, n) { dp[i] = dp[i - 1] + dp[i - 2]; }

    cout << dp[n];
}
0