View Code of Problem 60

#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<string>
#include<cmath>

using namespace std;

//void dfs(int s, string& temp, int& res) {
//
//	if (temp.size() == s) {
//		
//		res++;
//		return;
//	}
//
//	for (int i = 0; i < 2; i++) {
//
//		if (temp.size() > 0 && temp[temp.size() - 1] == '1' && i == 1)
//			continue;
//
//		temp += to_string(i);
//
//		dfs(s, temp, res);
//
//		temp.pop_back();
//	}
//}

int main()
{
	int T;
	cin >> T;

	int dp[41] = { 0 };
	dp[0] = 0;
	dp[1] = 2;
	dp[2] = 3;

	for (int i = 3; i < 41; i++)
		dp[i] = dp[i - 1] + dp[i - 2];

	for (int i = 0; i < T; i++) {

		int s;
		cin >> s;

		cout << "Scenario #" << i + 1 << ":" << endl;
		cout << dp[s] << endl << endl;
	}
}

Double click to view unformatted code.


Back to problem 60