题目大意:给出n(1≤n≤4)然后在一个n * 4的格子上放矩形,必须放一个2*2的(为题目背景下的曹操),然后剩余的位置要用三种矩形拼接。
解题思路:先枚举曹操的位置,然后用回溯的方式枚举出所有可能,计算总数。
#include <stdio.h>
#include <string.h>
const int N = 10;
const int d[4][2] = { {0, 0}, {0, 1}, {1, 0}, {1, 1} };
const int dir[3][3][2] = { { {0, 1}, {0, 0} }, { {1, 0}, {0, 0} }, { {0, 0} } };
const int cnt[3] = {2, 2, 1};
int r, v[N][N], tmp;
const int c = 4;
bool isInsert(int k, int x, int y) {
for (int i &