60分。

P1255 数楼梯

zjy0419 @ 2024-07-21 20:51:47

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

int main() {
    int n;
    cin >> n;
    long long a[n + 1],b,c;
    a[0] = 1;
    a[1] = 1;
    for (int i = 1; i < n; i++) {
        a[i + 1] = a[i - 1] + a[i];
    }
    cout << abs(a[n]);
}

by cancan1030 @ 2024-07-21 20:58:51

数据太大,得用高精度加法


by zjy0419 @ 2024-07-21 21:02:15

Ok,尝试一下。


by zjy0419 @ 2024-07-21 22:56:38

OK了,栓Q


by _Monkey_King_ @ 2024-08-21 09:51:35

采纳了


|