hdu acm 2569
此题不懂,为什么是2*d[i-1] + d[i-2]
#include <cstdlib> #include <iostream> using namespace std; int result[40]; int main() { int C, n; result[1] = 3; result[2] = 9; for (int i=3; i<40; ++i) result[i] = 2*result[i-1] + result[i-2]; cin >> C; while (C--) { cin >> n; cout << result[n]<< endl; } }