View Code of Problem 60

#include <iostream>
#include "vector"

using namespace std;

/**
 * kkmd66 四刷
 * @return
 */
int main() {

    //预先存储
    vector<long long> Fre(41);
    for (long long i = 0; i < 41; ++i) {
        if (i == 0)
            Fre[i] = 1;
        if (i == 1)
            Fre[i] = 2;
        if (i > 1)
            Fre[i] = Fre[i - 1] + Fre[i - 2];
    }

    int s;
    cin >> s;
    for (int i = 0; i < s; ++i) {
        int a;
        cin >> a;
        cout << "Scenario #" << i + 1 << ":" << endl;
        cout << Fre[a] << endl << endl;
    }

    return 0;
}

Double click to view unformatted code.


Back to problem 60