搜索
文章平均质量分 50
对你说的对
这个作者很懒,什么都没留下…
展开
-
Hihocoder 1426 E. What a Ridiculous Election(BFS+优先队列)
DescriptionIn country Light Tower, a presidential election is going on. There are two candidates, Mr. X1and Mr. X2, and both of them are not like good persons. One is called a liar and the other i...原创 2018-10-04 20:39:40 · 195 阅读 · 0 评论 -
POJ DFS
POJ1111 给定起点,求连通块的周长。 从起点开始搜索,将所有符合要求的X块标记。然后查找已经标记的块,判断是否是X连通块的边界块,计算周长。 #include#include#include#includeusing namespace std;int n,m,x,y;char mp[25][25];bool mark[25][25];int dir[原创 2017-12-16 21:43:10 · 391 阅读 · 0 评论 -
POJ 1077 生日蛋糕(DFS)
Description7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层生日蛋糕,每层都是一个圆柱体。设从下往上数第i(1 Ri+1且Hi > Hi+1。 由于要在蛋糕上抹奶油,为尽可能节约经费,我们希望蛋糕外表面(最下一层的下底面除外)的面积Q最小。 令Q = Sπ 请编程对给出的N和M,找出蛋糕的制作方案(适当的Ri和Hi的值),使S最小。原创 2017-12-14 10:08:59 · 170 阅读 · 0 评论 -
POJ 1376 Robot(BFS)
DescriptionThe Robot Moving Institute is using a robot in their local store to transport different items. Of course the robot should spend only the minimum time necessary when travelling from one pl原创 2017-12-13 18:45:56 · 245 阅读 · 0 评论 -
POJ2688 Cleaning Robot(BFS)
DescriptionHere, we want to solve path planning for a mobile robot cleaning a rectangular room floor with furniture.Consider the room floor paved with square tiles whose size fits the cleaning原创 2017-12-13 18:41:39 · 338 阅读 · 0 评论 -
POJ 3322 Bloxore I(BFS)
DescriptionLittle Tom loves playing games. One day he downloads a little computer game called 'Bloxorz' which makes him excited. It's a game about rolling a box to a specific position on a special原创 2017-12-11 22:05:37 · 300 阅读 · 0 评论 -
POJ scales(DFS)
Farmer John has a balance for weighing the cows. He also has a set of N (1 <= N <= 1000) weights with known masses (all of which fit in 31 bits) for use on one side of the balance. He places a cow on原创 2017-08-17 21:42:18 · 208 阅读 · 0 评论 -
Knights of ni(BFS)
Bessie is in Camelot and has encountered a sticky situation: she needs to pass through the forest that is guarded by the Knights of Ni. In order to pass through safely, the Knights have demanded that原创 2017-08-15 21:46:03 · 234 阅读 · 0 评论 -
HDU5305 Friends(DFS)
题目链接 有很多组测试样例,每一组测试样例有一个T,内包含T组样例。n个人m种朋友关系,将每个人的朋友分为在线朋友和离线朋友,在线朋友和离线朋友数目必须相同。问有多少种不同的安排方法,可以为0种。 思路: 如果一个人有奇数个朋友,分配方案一定为0.然后其他情况dfs回溯。#include<bits/stdc++.h>using namespace std;...原创 2018-07-16 20:47:55 · 105 阅读 · 0 评论 -
2018牛客多校训练--Two Graphs(DFS)
链接:https://www.nowcoder.com/acm/contest/139/D来源:牛客网题目描述Two undirected simple graphs and where are isomorphic when there exists a bijection on V satisfying if and only if {x, y} ∈ E2.Given...原创 2018-07-20 22:28:59 · 254 阅读 · 0 评论 -
HDU6341 Let Sudoku Rotate(DFS)
题目链接最少多少次小区域逆时针旋转操作能使给出的16*16方格经旋转后满足数独条件。思路: 每一个4*4小格子都可以判断一下是否还需旋转九十度:若是此小格子与它前面的每行都不冲突,与它前面的每一列都不冲突,则这个小格子不需要旋转九十度。#include <bits/stdc++.h>using namespace std;#define ll long lo...原创 2018-08-03 16:45:26 · 177 阅读 · 0 评论 -
搜索专题 H
1、简单描述 一个不大于200的数n,查找一个数m,使m是n的整数倍,且m是只由0和1组成的十进制数,m不超过100位,输出任意一个m。2、思路# include # include using namespace std;typedef unsigned long long int ll;bool vis;int n;void dfs(ll x,int n,int k原创 2017-05-09 23:25:13 · 263 阅读 · 0 评论 -
搜索专题 G
1、简单描述 人在m点,牛在k点,人去追牛,可以一次前进一步,可以一次后退一步,可以一次到达当前点数的二倍处。每走一步花费一秒,最小多长时间追到牛?2、思路#include#include#includeusing namespace std;int M,K;queue q;int ret[100001];bool vis[100001];int原创 2017-05-11 09:06:39 · 185 阅读 · 0 评论 -
搜索专题 D
1、简单描述一个n*n的方阵由.和#组成,允许放k个棋子,只有#处可以放棋子,共有多少种不同的放法。2、思路# include using namespace std;int n, m, sum, num[10];char mp[10][10];void init(){ memset(num, 0, sizeof num); for(int i =原创 2017-05-12 22:52:24 · 154 阅读 · 0 评论 -
搜索专题 J
1 简单描述有两堆纸牌,每堆纸牌有颜色不同的纸牌,按照一定规则混合洗牌。经过一系列洗牌,是否能组合成题中所给的排序。要是能,最少多少次洗牌。2 思路#include#include#include#includeusing namespace std;int main(){ char s1[105], s2[105]原创 2017-05-30 21:12:09 · 691 阅读 · 0 评论 -
搜索专题 A
1 简单描述用中继器接收信号,相邻的中继器不互相干扰。如果相邻的中继器使用不同的频道,那么就不会相互干扰。使用的中继频道数尽量减少。2 思路#include #include #include #include #include #include #include #include #include #include using namespa原创 2017-05-30 20:59:20 · 263 阅读 · 0 评论 -
搜索专题 I
1、简单描述从一个素数变化成另一个素数,每次变换只能更改一个数字,并且变换过程中所有出现的数均为素数,至少要经过多少种变换2、思路# include # include # include # include using namespace std;int n, m;const int N = 1e4 + 100;int vis[N];struct nod原创 2017-05-25 09:15:15 · 361 阅读 · 0 评论 -
搜索专题 L
1、简单描述立体迷宫,问从一个点到另一个点至少走多少步2、思路#include #include #include #include using namespace std;char mp[31][31][31];int vis[31][31][31];int k,n,m,sx,sy,sz,ex,ey,ez;int dir[6][3] = {{0,0,1原创 2017-05-25 09:09:28 · 225 阅读 · 0 评论 -
搜索专题 T
1、简单描述骑士在n*n的棋盘上按照图中的走法,从一点到另一点,最少走多少步?2、思路#include#include#includeusing namespace std;bool vis[400][400];int a[400][400];int n,sx,sy,ex,ey;int dir[8][2]={-2,1,-1,2,1,2,2,1,2,-1,1,-2,-1原创 2017-05-23 20:38:14 · 495 阅读 · 0 评论 -
搜索专题 F
1、简单描述给出一个m*n的矩阵,给出点(x,y),表示从该点开始搜,求该X块的周长。2、思路在四条边上再铺上.,计算.的个数#include #include using namespace std;char mp[21][21];bool vis[21][21];int n, m, x, y;int dirx[8] = {1, -1, 0, 0, 1,原创 2017-05-22 16:57:16 · 445 阅读 · 0 评论 -
搜索专题 O
1、简单描述n段网线,重新切割成k段。2、思路二分查找乱入搜索专题,不过所有的的算法都是搜索的优化,貌似没毛病。#include #include #include #include using namespace std;double l[10005];int n,k;const double eps = 1e-8;bool judge(double x){原创 2017-05-21 22:16:54 · 187 阅读 · 0 评论 -
搜索专题 Q
1、简单描述素数环,第一个位置为1,前后两个数相加和为素数。2、思路#include#include#includeusing namespace std;int n,a[21];bool vis[21]={0};int prime[12]={2,3,5,7,11,13,17,19,23,29,31,37};//1~20任意两个数相加和为素数的所有素数和bool is原创 2017-05-15 12:20:49 · 196 阅读 · 0 评论 -
搜索专题 B
1、简单描述一个骑士从(1,1)开始走,遍历整个棋盘,输出路径。2、思路#include#include#includeusing namespace std;int path[101][101], p, q, cnt;bool vis[101][101];bool flag;int dx[8] = {-1, 1, -2, 2, -2, 2, -1, 1};int原创 2017-05-15 12:15:37 · 157 阅读 · 0 评论 -
搜索专题 M
1、简单描述一个m*n的方阵,由*和@组成,计算共有多少个@块。2、思路#include#include#include#includeusing namespace std;int m,n;char mp[101][101];int dir[8][2]={{-1,0},{1,0},{0,1},{0,-1},{-1,-1},{-1,1},{1,-1},{1,1}};原创 2017-05-12 23:00:41 · 187 阅读 · 0 评论 -
搜索专题 S
1简单描述数独,在一个9x9的方格中,需要把数字1-9填写到空格当中,并且使方格的每一行和每一列中都包含1-9这九个数字。同时还要保证,空格中用粗线划分成9个3x3的方格也同时包含1-9这九个数字。2 思路# include using namespace std;struct Node{ int x,y;}node[100];int mp[10原创 2017-05-30 21:37:16 · 152 阅读 · 0 评论