![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
搜索
Ha.wang
这个作者很懒,什么都没留下…
展开
-
1155 Heap Paths (30分)
题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/1071785408849047552 题意:给出一颗完全二叉树,打印出从根节点到所有叶节点的路径,打印顺序先右后左,即先序遍历的镜像。然后判断该树是大顶堆、小顶堆或者不是堆~ 分析:1.深搜打印出所有路径(从右往左,即先序的镜像),通过push和pop回溯,维护路径 2...原创 2020-01-09 18:47:40 · 76 阅读 · 0 评论 -
E - 【粉色】浣熊市下水道 Gym - 102072K(bfs,可移动障碍物)
##&# #&*# 一单位时间后 ##&A L#&# #&## ##*# 二单位时间后 ##&A ##&# L&*# 三单位时间后 ##&A ##&# #&## L#*# 四单位时间后 ##&A ##&# #&*# #L## 里昂如果再向左走的话就会跟僵尸碰个正着,而且不论里昂怎么往...原创 2019-08-17 22:40:15 · 118 阅读 · 0 评论 -
K - Assigning Frequencies UVALive - 8273(dfs暴力)
题意是:,往这个图中的点放置频率,总共有三种频率,如果这两个点连通,并且频率一样,则与题目不符,反之任意两个连通的点频率都要不一样; 思路:dfs暴力枚举 #include<bits/stdc++.h> using namespace std; int mp[30][30]; int vis[30]; int n, m; int dfs(int now) { for(int i...原创 2019-08-17 22:33:07 · 167 阅读 · 0 评论 -
Pots POJ - 3414(bfs+路径输出)
题目链接:https://cn.vjudge.net/contest/313994#problem/F 思路:bfs需要输出路径,不能用c++的queue,因为回溯的过程要用到队列的下标,所以我们需要模拟队列 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm&g...原创 2019-08-24 21:56:23 · 173 阅读 · 0 评论 -
Prime Path POJ - 3126(筛素+bfs)
题目链接:https://cn.vjudge.net/contest/313994#problem/E #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<queue> using namespace std; bool ...原创 2019-08-24 21:46:00 · 104 阅读 · 0 评论 -
D - Find The Multiple POJ - 1426(dfs||bfs)
题目链接:https://cn.vjudge.net/contest/313994#problem/D dfs或者bfs都可以,dfs最多20层(打表) bfs代码 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<queue&g...原创 2019-08-24 21:34:45 · 162 阅读 · 0 评论 -
Dungeon Master POJ - 2251(广搜三维)
题目链接:https://cn.vjudge.net/contest/313994#problem/B 就是多加一维,其他没啥 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<stac...原创 2019-08-24 21:05:15 · 70 阅读 · 0 评论 -
棋盘问题 POJ - 1321(搜索dfs)
题目链接:https://cn.vjudge.net/contest/313994#problem/A 题意:给定一个不规则的棋盘,往这个棋盘里摆放K个棋子,求棋子的最大摆放组合数。 思路:定义一个标记列的数组,因为dfs的过程是从上往下相当于一个标记数组 #include<iostream> #include<cstdio> #include<cstring>...原创 2019-08-24 21:00:38 · 125 阅读 · 0 评论 -
I - I Will Go Gym - 101875I(dfs序)
题目链接:https://cn.vjudge.net/contest/315987#problem/I 题意:N个人要参加一个局,每个人有自己的好朋友,如果他的好朋友来,他才有可能来。N个人的关系不够成环。Q次查询,问若x来了,y是否肯定来。 分析:若点y是x的祖先,则y肯定回来。一次dfs确定每个点覆盖的区间,若点x的dfs序在y的覆盖区间内,则y肯定会来。 #include<iostre...原创 2019-08-24 20:31:25 · 210 阅读 · 0 评论 -
G - Ancient Go HDU - 5546(BFS)
Yu Zhou likes to play Go with Su Lu. From the historical research, we found that there are much difference on the rules between ancient go and modern go. Here is the rules for ancient go they were pla...原创 2019-08-08 21:29:26 · 237 阅读 · 0 评论