
DFS
H煊
缓一会儿。。。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
2017网易春招 工作安排(dfs)
现在有n位工程师和6项工作(编号为0至5),现在给出每个人能够胜任的工作序号表(用一个字符串表示,比如:045,表示某位工程师能够胜任0号,4号,5号工作)。现在需要进行工作安排,每位工程师只能被安排到自己能够胜任的工作当中去,两位工程师不能安排到同一项工作当中去。如果两种工作安排中有一个人被安排在的工作序号不一样就被视为不同的工作安排,现在需要计算出有多少种不同工作安排计划。 输入描述: 输原创 2017-05-27 17:18:49 · 708 阅读 · 0 评论 -
POJ 3600 Subimage Recognition(dfs)
Subimage Recognition 题意:r*c的01格子1,和R*C的01个格子2( 思路:暴力枚举删除某些列,然后观察是否完全匹配即可; 代码: #include #include #include using namespace std; char mp1[25][25], mp2[25][25]; int a[25]; int r, c, R原创 2017-09-11 22:18:39 · 262 阅读 · 0 评论 -
2012 ACM/ICPC 长春赛区网络赛 1006(dfs)
LianLianKan 题意:问每次都从顶部元素向下消去距离小于6的相同元素能否消完全部元素。 代码: #include #include #include using namespace std; const int MAXN=1010; int a[MAXN]; bool used[MAXN]; int dfs(int n) { while(n>0&&used原创 2017-09-11 21:30:41 · 318 阅读 · 0 评论 -
POJ 1321 棋盘问题(dfs)
棋盘问题 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 50481 Accepted: 24459 Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编原创 2017-09-10 20:54:31 · 168 阅读 · 0 评论 -
蓝桥杯 大臣的旅费(dfs)
历届试题 大臣的旅费 时间限制:1.0s 内存限制:256.0MB 问题描述 很久以前,T王国空前繁荣。为了更好地管理国家,王国修建了大量的快速路,用于连接首都和王国内的各大城市。 为节省经费,T国的大臣们经过思考,制定了一套优秀的修建方案,使得任何一个大城市都能从首都直接或者通过其他大城市间接到达。同时,如果不重复经过大城市,从首都原创 2017-08-24 14:04:01 · 304 阅读 · 0 评论 -
The 36th ACM/ICPC Asia Regional Shanghai Site 4016(dfs+剪枝)
Magic Bitwise And Operation 题意:n个数字取出k个数字进行“与”操作,求最少的结果。 思路:首先明白“与”操作的结果,显然应先将数字排列,小的先取必然最优。下面dfs+剪枝即可, 剪枝: 1. dfs路径上不断更新ans,不用等搜到底,“与“”操作只会越来越小; 2. 与后缀“与”如果没有ans小就剪枝; 代码: #include原创 2017-09-13 16:04:46 · 253 阅读 · 0 评论 -
Codeforces 663C Graph Coloring(图染色dfs)
题意: 给出一张图,每条边都有一个颜色(要么是红色要么是蓝色),如果翻转一个顶点,那么这个顶点相邻的边都会变色(红变蓝,蓝变红),求使得整个图变成同色的最小操作数,并且输出要翻转哪些顶点。 思路:最小操作数一定是全部变成红色和全部变成蓝色操作数的最小值,我们以全部变成红色举例:如果一条边是红色,那么这条边的两个顶点必然是:要么同时不翻转要么同时翻转,如果一条边是蓝色,那么这条边的两原创 2017-09-13 15:28:37 · 485 阅读 · 0 评论 -
POJ 2083 Fractal(dfs)
Fractal Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 9938 Accepted: 4567 Description A fractal is an object or quantity that displays self-similarity,原创 2017-08-15 19:53:41 · 235 阅读 · 0 评论 -
ZOJ 1119 SPF(割点)
SPF Time Limit: 2 Seconds Memory Limit: 65536 KB Background Consider the two networks shown below. Assuming that data moves around these networks only between directly connected nodes原创 2017-08-25 13:15:44 · 368 阅读 · 0 评论 -
2017百度之星资格赛 度度熊的午饭时光(dfs)
度度熊的午饭时光 Accepts: 525 Submissions: 6950 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description 度度熊最期待每天的午饭时光,因为早饭菜品清淡,晚饭减肥不敢吃太多(原创 2017-08-07 00:05:05 · 315 阅读 · 0 评论 -
Firetruck(dfs)
题目来源:1991 ACM Final,Problem A,Firetruck(UVa 208) 题意:给定目标街口,问从街口1到目标街口路径条数并打印出路径。(最多20个街口) 思路:本题是典型的路径搜索问题,搜索从位置1开始。依次将搜索到的街口编号放入路径path中。如果搜索到目标街口,那么本次搜索结束,并输出该路径,可达路径数增加1。如果没有到达目标街口,那么判断当前可到达的街口原创 2017-08-14 13:09:22 · 300 阅读 · 0 评论 -
ZOJ 1142 Maze(dfs)
Maze Time Limit: 2 Seconds Memory Limit: 65536 KB By filling a rectangle with slashes (/) and backslashes (\), you can generate nice little mazes. Here is an example: As you can see,原创 2017-08-18 14:31:45 · 284 阅读 · 0 评论 -
ZOJ 1085 Alien Security(SPFA+dfs)
Alien Security Time Limit: 2 Seconds Memory Limit: 65536 KB You are in charge of security at a top-secret government research facility. Recently your government has captured a live extra-原创 2017-08-16 21:04:29 · 457 阅读 · 0 评论 -
ZOJ 1084 Channel Allocation(dfs)
Channel Allocation Time Limit: 2 Seconds Memory Limit: 65536 KB When a radio station is broadcasting over a very large area, repeaters are used to retransmit the signal so that every rece原创 2017-08-16 20:20:36 · 519 阅读 · 0 评论 -
ZJU1002-Fire Net(dfs)
Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall. A blockhouse is a small castle原创 2017-07-10 13:19:21 · 326 阅读 · 0 评论 -
2017图灵杯问题D 简单的图形输出(dfs)
题目描述 谢尔宾斯基三角形是一种分形,它的构造过程是这样的: 1.取一个实心的三角形。(多数使用等边三角形) 2.沿三边中点的连线,将它分成四个小三角形。 3.去掉中间的那一个小三角形。 4.对其余三个小三角形重复1。 我们想尝试用斜线、反斜线和下划线画出谢尔宾斯基三角,假设最小的三角是长这样的: /\ /__\ 具体规律详见样例。 输入 多组数据输入输出原创 2017-06-12 14:34:43 · 755 阅读 · 0 评论 -
ZOJ1008-Gnome Tstravex(dfs)
Gnome Tetravex Time Limit: 10 Seconds Memory Limit: 32768 KB Hart is engaged in playing an interesting game, Gnome Tetravex, these days. In the game, at the beginning, the player is given原创 2017-07-11 15:54:48 · 225 阅读 · 0 评论 -
POJ2676 Sudoku(dfs)
Description Sudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits from 1原创 2017-07-10 16:54:28 · 252 阅读 · 0 评论 -
FZU 2181 快来买肉松饼(dfs)
快来买肉松饼 题意:给出n个人, 要从他们中选出奇数个人(人数 >= k)围成圈,,接着给出m对敌对关系, 敌对关系的人不能相邻,,问能不能选出奇数个人构成圈.。 思路:将可以相邻的人建边,,那么就是对次图找一个奇数环, 同时奇数环的点数>=k.。dfs一下即可。 代码: #include #include #include using namespace std;原创 2017-09-12 22:38:45 · 300 阅读 · 0 评论