夢追い人

"It takes a dreamer to make a dream come true."―Vincent Willem van Gogh

いつかの

NumberofFiboCalls

単純BP

class NumberofFiboCalls {
public:
	vi dp1, dp0;
	void init() {
		dp0[0] = 1;
		dp1[1] = 1;
		for (int i=2; i<41; i++) {
			dp0[i] = dp0[i-1] + dp0[i-2];
			dp1[i] = dp1[i-1] + dp1[i-2];
		}
	}
   vector <int> fiboCallsMade( int n ) {
		vi res(2, 0);
		dp1 = vi(41);
		dp0 = vi(41);
		init();
		res[0] = dp0[n];
		res[1] = dp1[n];
		return res;
   }
};
広告を非表示にする