// yukicodr // No.44 DPなすごろく //二次元可変配列 //vector > mass; //vector > memo; //#include "stdafx.h" #include #include #include //list #include //tree #include //連想配列 #include //hash #include //hash #include #include using namespace std; #define START (0) #define RIGHT (1) #define UP (2) #define LEFT (3) #define DOWN (4) typedef unsigned long long ULL; int H, W; ULL ans = 0; ULL memo[51]; void solve(int a) { if (a >= H) { if (a == H) { ans++; } return; } if (memo[a] == 0) { solve(a + 1); solve(a + 2); //左右の枝を計算した後は、この時点での回答を今後再利用するために保存しておく //cout <<"DP["<< a << "] is " << ans << endl; memo[a] = ans; } else { // すでに一度計算したことがある場合はその計算結果を使う //cout << "DP[" << a << "] is calcurated.-->" << memo[a] << endl; ans += memo[a]; } } int main() { cin >> H; solve(0); cout << ans << endl; //getchar(); return 0; }