HDU 2046 骨牌铺方格
线性Dp Fabonacci
#include <algorithm> #include <iostream> #include <cstring> #include <cstdio> using namespace std; long long n, dp[55]; int main() { while (~scanf("%d", &n)) { memset(dp, 0, sizeof(dp)); dp[1] = 1, dp[2] = 2; for (int i = 3; i <= n; ++i) dp[i] = dp[i - 1] + dp[i - 2]; printf("%lld\n", dp[n]); } return 0; }