枚举行和列即可,当前已经放下cnt个棋子,当前已经搜索到第r行,如果 n - r + cnt < k 直接退出,因为后面无法放下剩下的棋子. AC代码 #include<cstdio> #include<cstring> const int maxn = 10; char G[maxn][maxn]; int vis[maxn], n, k; int ans; void dfs(int x, int cnt){ if(cnt == k){ ans++; return; }…
ID Origin Title 454 / 1008 Problem A POJ 1321 棋盘问题 328 / 854 Problem B POJ 2251 Dungeon Master 335 / 1101 Problem C POJ 3278 Catch That Cow 161 / 503 Problem D POJ 3279 Fliptile 247 / 526 Problem E POJ 1426 Find The Multiple 205 / 330 Pro…
Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,000) on the same number line. Farmer John has two m…