
dfs
绝不挂科
这个作者很懒,什么都没留下…
展开
-
第六次-G hdu1241-dfs
hdu1241Oil Deposits The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a...原创 2019-01-25 23:47:57 · 177 阅读 · 0 评论 -
Capricorn's Trial-G
Today is Ignatius’ birthday. He invites a lot of friends. Now it’s dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each other, a...原创 2019-01-26 16:46:56 · 178 阅读 · 0 评论 -
第十次-G-hdu-1213-dfs连通块/并查集
HDU-1213题意: Ignatius生日,他觉得朋友们不认识坐一起很尴尬,想把认识的朋友们安排在同一张桌子,问我们这样需要几张桌子dfs题解:用二维数组标记互相认识的朋友们,相当于求连通块吧…认识了就互通了,记录使用dfs的次数,用了几次dfs就需要几张桌子。#include<iostream>#include<cstring>using namespace ...原创 2019-01-28 16:54:09 · 194 阅读 · 0 评论 -
第五次-H-poj-3984
poj-3984题解:迷宫,然后求最短路径,此题只能向下或向右走,从左上角走到右下角。用visit判断每个格子是否已经访问过了,#include&lt;cstdio&gt;#include&lt;cstring&gt;int n,m,i,j,k,flag;int data[5][5],vis[5][5]; //迷宫//标记是否访问int dir[2][2]={{1,0},{0,1}}...原创 2019-01-29 11:40:50 · 148 阅读 · 0 评论 -
第九天-F-hdu-1016-dfs
hdu-1016题意:意思是给你一个数n,要构成一个素数环,这个素数由1-n组成,它的特征是选中环上的任意一个数字i,i与它相连的两个数加起来都分别为素数,满足就输出。思路就是深搜思想把每种情况遍历一次我的代码:#include &lt;iostream&gt;#include&lt;cstring&gt;#include&lt;cstdio&gt;using namespace s.原创 2019-01-29 15:55:22 · 137 阅读 · 0 评论 -
第十天-hdu-2181-dfs
hdu-2181#include<iostream>#include<cstring>using namespace std;int map[21][3];//记录与第i个城市相邻的三个城市bool vis[22]; //标记有没有走过int a[22];int m,k;//m为第m个城市,k为第几种路线void dfs(int x, int num) ...原创 2019-01-29 17:47:11 · 121 阅读 · 0 评论 -
poj-1321-搜索
题目链接: poj-1321递归思想,只是本题只要判断不在一行或者一列,规定了棋子放置位置,故要增加判断条件。#include<iostream>#include<cstdio>#include<cstring>using namespace std;char a[10][10]; //记录棋盘位置int book[10]; ...原创 2019-03-01 19:05:06 · 477 阅读 · 0 评论 -
poj-1426
题目链接:poj-1426#include<iostream>#include<cstdio>#include<cstring>#include<queue>#define maxn 205using namespace std;int n;int work;void dfs(int x, unsigned long long y...原创 2019-03-01 20:20:56 · 137 阅读 · 0 评论