搜索
文章平均质量分 76
___Evan
这个作者很懒,什么都没留下…
展开
-
HDU-1584 蜘蛛牌 搜索
http://acm.hdu.edu.cn/showproblem.php?pid=1584#include#include#include#include#include#include#include#includeusing namespace std;const int maxn = 15;const int inf = 1<<30;int原创 2013-11-17 19:35:37 · 447 阅读 · 0 评论 -
POJ-1915 Knight Moves 简单搜索
F - Knight MovesTime Limit:1000MS Memory Limit:30000KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionBackgroundMr Somurolov, fabulous chess-gamer indeed, asserts t原创 2014-01-14 14:26:25 · 497 阅读 · 0 评论 -
FAFU-1410 九数矩阵 康拓展开
http://acm.fafu.edu.cn/problem.php?id=1410类似八数码问题 用整形存状态4秒 康拓展开式1秒#include#include#include#include#includeusing namespace std;const int maxn = 1005;const int inf = 1<<30;int n;int f[10]原创 2013-12-13 14:49:16 · 684 阅读 · 0 评论 -
HDU-1007 Quoit Design 最小距离点对
求平面内任意两点间距离1.蛮力法( 时间复杂度O(n^2) 适用于点的数目比较小的情况下)算法描述:已知集合S中有n个点,一共可以组成n(n-1)/2对点对,蛮力法就是对这n(n-1)/2对点对逐对进行距离计算,通过循环求得点集中的最近点对:2、分治法 1)算法描述:已知集合S中有n个点,分治法的思想就是将S进行拆分,分为2部分求最近点对。算法每次选择一原创 2013-11-29 20:10:49 · 1106 阅读 · 0 评论 -
POJ - 1101 The Game DFS
H - The GameTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionOne morning, you wake up and think: "I am such a good programmer.原创 2014-01-14 18:07:55 · 457 阅读 · 0 评论 -
HDU-1129 Channel Allocation
A - Channel AllocationTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionWhen a radio station is broadcasting over a very large are原创 2014-01-12 15:22:11 · 762 阅读 · 0 评论 -
POJ-1111 Image Perimeters 简单搜索
G - Image PerimetersTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionTechnicians in a pathology lab analyze digitized images of s原创 2014-01-14 15:33:00 · 457 阅读 · 0 评论 -
HDU-4771 Stealing Harry Potter's Precious DFS + BFS
A - Channel AllocationTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionWhen a radio station is broadcasting over a very large are原创 2014-01-12 12:39:44 · 422 阅读 · 0 评论 -
HDU-3912 Turn Right 简单搜索
D - Turn RightTime Limit:2000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionThis summer, ELT and his classmates went to Beijing for a training原创 2014-01-14 17:05:37 · 544 阅读 · 0 评论 -
POJ-2415 Hike on a Graph 搜索
题目连接题目大意:在一个完全图(每条边都有各自的颜色)中有3个piece,每个piece只能沿一条边移动(移动的条件为:这条边的颜色与另外两个piece间的边的颜色一样);问把三个piece移动到同一个点所需要的最小步数。BFS里的结束判断还是找个一个判断好点 出队再判断数据大时间废挺大QAQ血的教训#include#include#include#i原创 2014-01-15 16:01:43 · 509 阅读 · 0 评论 -
蓝桥杯历届真题 九宫重排 康拓展开式
问题描述 如下面第一个图的九宫格中,放着 1~8 的数字卡片,还有一个格子空着。与空格子相邻的格子中的卡片可以移动到空格中。经过若干次移动,可以形成第二个图所示的局面。 我们把第一个图的局面记为:12345678. 把第二个图的局面记为:123.46758 显然是按从上到下,从左到右的顺序记录数字,空格记为句点。 本题目的任务是已知九宫的初态和终态,求最少经过原创 2014-05-06 22:34:58 · 654 阅读 · 0 评论 -
HDU-1455 Sticks 经典dfs剪枝
http://acm.hdu.edu.cn/showproblem.php?pid=1455#include#include#include#include#include#include#include#includeusing namespace std;const int maxn = 105;const int inf = 1<<30;int n,po原创 2013-11-17 16:51:01 · 546 阅读 · 0 评论 -
HDU-2363 Cycling
求海拔差最小的前提下的最短路思路:暴力搜索 =。=TL了无数次 只因没判重 欲哭无泪QAQ#include "stdio.h"#include "string.h"#include "vector"#include "queue"#include "algorithm"using namespace std;const int maxn = 105;const原创 2013-11-01 18:25:32 · 569 阅读 · 0 评论 -
HDU - 1226 超级密码
题目连接重点是余数判重 其他就是简单搜索问题但是有两个bug:1、M个整数可能有重复的。2、N可能为0。 int judge(node &a) { int tmp=0; int i; for(i=0;i<a.len;i++) { tmp=(tmp*c+a.base原创 2014-01-13 16:19:44 · 441 阅读 · 0 评论 -
HDU-1547 Bubble Shooter 搜索
http://acm.hdu.edu.cn/showproblem.php?pid=1547 注意奇偶方向 #include "stdio.h"#include "string.h"const int maxn = 105;int h,w,sx,sy,ans;int xs[][6] = { {0,-1,-1,0,1,1},{0,-1,-1,0,1,1}};int y原创 2013-11-18 21:06:05 · 1058 阅读 · 0 评论 -
HDU - 1104 Remainder 搜索
本题是bfs,不过有点小阴谋,在num因为大量运算时会很大,于是我们要取余,但不能直接用%k,而是用%km(k*m),因为不止要和k线性同余还要和m线性同余,也就是说,如果只用%k,那么我对n做了一步处理后,产生的结果只对k线性同余,假如下一步用%m,那么就错了比如,8 3,10,op为+%,如果用%k,答案就是2,但正确答案是1。#include#include#incl原创 2013-11-06 10:39:33 · 569 阅读 · 0 评论 -
HDU-1180 诡异的楼梯
迷宫 就多了个楼梯的问题 可以停在原点 楼梯是瞬间通过#include#include#include#include#include#include#includeusing namespace std;const int maxn = 25;const int inf = 1<<30;int n,m;char map[maxn][maxn];int x原创 2013-11-06 17:59:45 · 569 阅读 · 0 评论 -
HDU-1175 连连看 DFS
#include#include#include#include#include#include#includeusing namespace std;const int maxn = 1005;const int inf = 1<<30;int n,m;int x1,x2,y1,y2,flag;int map[maxn][maxn];int xs[] = {0,1,0原创 2013-11-06 18:41:34 · 496 阅读 · 0 评论 -
HDU-1401 Solitaire 搜索
题意:8*8的棋盘 固定4个棋子 问能否在8步以内(包括8步)从一个状态移动到另个状态 移动的时候如果所移动的位置也是棋子 可以直接跳过 (类似跳棋)暴力搜索 8维数组表示状态恶心的要死 QAQ MLE 压入栈的时候加了个条件后AC#include #include #include using namespace std;const int maxn = 8;bool原创 2013-11-20 17:02:20 · 612 阅读 · 0 评论 -
HDU-1426 数独 搜索
http://acm.hdu.edu.cn/showproblem.php?pid=1426全暴力 注意输入格式比较坑#include#include#include#include#includeusing namespace std;const int maxn = 15;const int inf = 1<<30;int pos;int map[maxn][原创 2013-11-20 21:57:59 · 648 阅读 · 0 评论 -
HDU-1518 Square 搜索
http://acm.hdu.edu.cn/showproblem.php?pid=1518经典DFS+截枝#include#include#include#includeusing namespace std;const int maxn = 105;const int inf = 1<<30;int n,flag,L;int len[maxn];bool vis[ma原创 2013-11-20 18:22:25 · 656 阅读 · 0 评论 -
HDU-1044 Collect More Jewels BFS + DFS
/*一道将BFS和DFS联合起来做的题目。题意:有一个n*m的castle?然后里面某些点放了些宝藏,每个宝藏都是具有不同的自身价值,现在一个人在入口处,剩下t时间,问怎么样才能在给定的时间下获得最大的宝藏价值(就是尽量贪婪)大概的思路:对整个城堡做bfs,bfs求得某个点(其实包含3种,入口。出口。宝藏)到另外一个点(也是那3种)之间的最短路。然后从入口处开始进行dfs搜索,比较。算原创 2013-11-02 22:48:10 · 530 阅读 · 0 评论 -
HDU-1732 Push Box BFS + BFS
http://acm.hdu.edu.cn/showproblem.php?pid=1732推三个箱子 难点主要是状态表示#include#include#include#include#include#include#includeusing namespace std;const int maxn = 8;int n,m,pos;char map[max原创 2013-11-12 14:58:34 · 564 阅读 · 0 评论 -
HDU-1728 逃离迷宫
http://acm.hdu.edu.cn/showproblem.php?pid=1728注意行列反了 用经过每个点的最小转弯数来标记点是否压入队列#include#include#include#include#include#include#includeusing namespace std;const int maxn = 105;const int原创 2013-11-13 13:17:15 · 392 阅读 · 0 评论 -
HDU-1043 Eight 八数码问题
http://acm.hdu.edu.cn/showproblem.php?pid=1043#include#include#include#include#include#include#include#includeusing namespace std;const int maxn = 105;const int inf = 1<<30;int xs[]原创 2013-11-13 21:25:06 · 474 阅读 · 0 评论 -
FAFU- 1387 Astar寻妹纸 a*
http://acm.fafu.edu.cn/problem.php?id=1387 #include#include#include#includeusing namespace std;const int maxn = 410;const int inf = 1<<29;int n,m;int map[maxn][maxn];int xs[] = {原创 2013-10-24 17:02:14 · 646 阅读 · 0 评论