View Code of Problem 60

#include <iostream>
#include "vector"

using namespace std;

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

    //预先存储
    vector<int> Fre(41);
    for (int 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, count = 0;
    cin >> s;
    while (s--) {
        count++;
        int a;
        cin >> a;
        cout << "Scenario #" << count << ":" << endl;
        cout << Fre[a] << endl << endl;
    }

    return 0;
}

Double click to view unformatted code.


Back to problem 60