• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






Baudelaire

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理
上一页 1 2 3 下一页

2021年4月3日

P1294 高手去散步 (基础模板)
摘要: #include <iostream> #include <set> #include <vector> #include <cmath> #include <cstdio> #include <cstring> #include <algorithm> #include <queue> #incl 阅读全文
posted @ 2021-04-03 14:05 Baudelaire 阅读(86) 评论(0) 推荐(0)
 
八皇后问题(dfs)(回溯)
摘要: //思路:采用一维的方式//搜索每一行,从左到右,逐个查看其是否符合于当前的规范//对于一个二维的空间图,一个位置上,对角线上的坐标,x+y等于一个定值//或者x-y+n会是一个定值#include <iostream> #include <set> #include <vector> #inclu 阅读全文
posted @ 2021-04-03 13:23 Baudelaire 阅读(78) 评论(0) 推荐(0)
 
P1747 好奇怪的游戏(结构体化,bfs)
摘要: //这道题学到了如何结构体化,把变量强行转变成一个结构体并推入队列中//两个变量的化,可以采用make_pair的方式//一开始想用暴搜,但是暴搜情况下,回溯会影响最短路//一般情况下,求最短路的时候,都用bfs,而非dfs//这题还有个隐性条件就是不能越界,棋盘就那么大#include <iost 阅读全文
posted @ 2021-04-03 10:51 Baudelaire 阅读(110) 评论(0) 推荐(0)
 

2021年4月1日

P1123 取数游戏(回溯,暴力枚举
摘要: //开始对回溯有了点概念,//即消除这点被取过造成的状态改变,使每次搜索都用的是最初的状态#include <iostream> #include <set> #include <vector> #include <cmath> #include <cstdio> #include <cstring 阅读全文
posted @ 2021-04-01 18:03 Baudelaire 阅读(116) 评论(0) 推荐(0)
 
P1706 全排列问题 回溯DFS
摘要: //全排列的回溯,我还没看懂,如何实现的回溯 //一直以为排列的时候,数据会互相干扰,发现都是一次性 一条龙找完,然后直接输出,不存在中途又跑另外一个dfs的鬼畜情况 #include <iostream> #include <set> #include <vector> #include <cma 阅读全文
posted @ 2021-04-01 13:50 Baudelaire 阅读(42) 评论(0) 推荐(0)
 
求先序排列(简单
摘要: #include <iostream> #include <set> #include <vector> #include <cmath> #include <cstdio> #include <cstring> #include <algorithm> #define ll long long u 阅读全文
posted @ 2021-04-01 11:08 Baudelaire 阅读(75) 评论(0) 推荐(0)
 
P1460 [USACO2.1]健康的荷斯坦奶牛 Healthy Holsteins(好题啊,终于开始用到了回溯,而且懂得了如何存数据
摘要: #include <iostream> #include <set> #include <vector> #include <cmath> #include <cstdio> #include <cstring> #include <algorithm> #define ll long long u 阅读全文
posted @ 2021-04-01 10:55 Baudelaire 阅读(113) 评论(0) 推荐(0)
 
P1162 填涂颜色(DFS 解题方式新颖
摘要: 题目链接https://www.luogu.com.cn/problem/P1162//一开始想找如何判断0在1的封闭曲线内,后来发现只要找在1之外的就可以//而在1之外的点,一般都可以通过不断扩展最后与边缘相接//所以只要dfs四个边上为0的点,不断往里找0,并把其的vis赋值为1//最后vis既 阅读全文
posted @ 2021-04-01 09:37 Baudelaire 阅读(43) 评论(0) 推荐(0)
 

2021年3月30日

DFS AT1350 深さ優先探索
摘要: #include <iostream> #include <set> #include <vector> #include <cmath> #include <cstdio> #include <algorithm> #define ll long long const int M = 1e3 + 阅读全文
posted @ 2021-03-30 16:43 Baudelaire 阅读(47) 评论(0) 推荐(0)
 
搜素BFS P1451 求细胞数量
摘要: 通过队列 BFS版本 #include <iostream> #include <set> #include <vector> #include <cmath> #include <cstdio> #include <algorithm> #include <queue> #define ll lo 阅读全文
posted @ 2021-03-30 16:11 Baudelaire 阅读(114) 评论(0) 推荐(0)
 
上一页 1 2 3 下一页