LA 6560 - The Urge to Merge
思路:状压dp,1表示要和下一个位置竖直乘。0表示不,这样递推下去就可以
代码:
#include#include #include using namespace std;const int N = 1005;const int INF = 0x3f3f3f3f;int g[N][3], dp[2][8], n;bool judge(int u, int f) { for (int i = 0; i < 3; i++) if (u&(1<