
深搜
yzlmhzz
记录秃头之旅
展开
-
林克的回忆(3)
二进制的应用,深度优先搜索原创 2022-06-20 19:56:38 · 621 阅读 · 0 评论 -
英杰们的蛋糕塔
#include <iostream>#include <cmath>using namespace std;int V, N, res = 1000000;int mins[21] = {0}, minv[21] = {0};void cake(int pos, int r, int h, int v, int s) { //剪枝 if(v > V || s >= res) return; if((V - v) * 2 /...原创 2022-04-29 18:26:16 · 723 阅读 · 0 评论 -
小猫爬山(深搜)
尝试每只猫的所有放法:放在已有的可以放下的车子里或放在新车子#include <iostream>#include <algorithm>using namespace std;int N, W, cat[18], res, car[18] = {0};void judge(int ct, int cr) { //剪枝 if(cr > res) return; //所有猫都放下了 if(ct == N) { ...原创 2022-04-27 17:53:47 · 392 阅读 · 0 评论 -
海拉鲁城堡问题
#include <iostream>using namespace std;int m, n, num[50][50];int judge(int x, int y) { //判断边界 if(x < 0 || x >= m || y < 0 || y >= n || num[x][y] == -1) return 0; int pos[4], res = 1, temp = num[x][y]; //化为二进制 ...原创 2022-04-24 09:14:06 · 203 阅读 · 0 评论 -
骑士林克的怜悯
#include <iostream>using namespace std;int p, q;char resx[26], resy[26];int dy[8] = {-2, -2, -1, -1, 1, 1, 2, 2}, dx[8] = {-1, 1, -2, 2, -2, 2, -1, 1};//判断该点是否走过int judge(int x, int y, int pos) { for (int i = 0; i <= pos; i++)...原创 2022-04-19 10:10:57 · 1134 阅读 · 0 评论 -
净化迷雾森林
#include<iostream>using namespace std;char ch[20][20];int W, H, dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0};int choice (int r, int l) { int res = 1; //净化该点 ch[r][l] = '#'; //向四个方向搜索 for (int i = 0; i < 4; i++) {...原创 2022-04-19 10:09:16 · 276 阅读 · 0 评论