![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
搜索
文章平均质量分 77
asuxiexie
这个作者很懒,什么都没留下…
展开
-
POJ 2243 || HDU 1372:Knight Moves(BFS)
简单搜索直接代码:#include#include#include#includeusing namespace std;char a,c;int e,f;int dx[8] = {-2, -2, -1, -1, 1, 1, 2, 2};int dy[8] = {-1, 1, -2, 2, -2, 2, -1, 1};int qq[9][9];struct node{原创 2014-07-17 17:43:05 · 712 阅读 · 0 评论 -
poj 1088 滑雪
记忆化搜索。。对每个点能走的最远进行记录,如果走过,直接返回上一层。。最后遍历找出最大值。。#include#include#include#includeusing namespace std;struct node{ int q,w;}s[104][105];int a,b;int yy[105][105];int map[4][2]={1,0,-1,0,0,原创 2014-07-30 10:29:22 · 514 阅读 · 0 评论 -
hdu 2610and2611
留着看;转: 很好的两道搜索题,都用到了判重。。。orz....不怎么会,看了大牛的解题报告才理解。。。跪神牛大牛的hdu 2610思路:题意很简单就是在给定的序列中找到固定个数的递增的子序列,如果子序列的总个数少于要求的个数,那么就把所有的子序列输出即可,注意每组测试用例就为有一空行。技巧一:重判,这里有两个重判,第一个重判是判断如果搜索的是子序列的第一个元素,那么转载 2014-07-09 16:37:41 · 594 阅读 · 0 评论 -
poj 2251 Dungeon Master
这个题只需建一个3维数组即可。其余与普通深搜一样。原创 2014-07-09 15:04:31 · 492 阅读 · 0 评论 -
poj 1753 Flip Game
本题就是枚举所有情况,ranhuo原创 2014-07-08 12:38:46 · 438 阅读 · 0 评论 -
poj 1321 棋盘问题
这是简单的深搜题,但本人也是看了网上的提示才写出的。原创 2014-07-07 16:57:00 · 477 阅读 · 0 评论 -
poj 1426 Find The Multiple
题意为求出只由0,1组成的并且是所给数倍数的数,广搜。。因为首位不能为0,因此必为1;所以搜索的下一层为上一层的10倍和10倍加1;#include#include#includeusing namespace std;__int64 s[9999999];__int64 r;void show(int q){ int i,j; s[0]=1; j=0; i=0;原创 2014-07-12 20:31:39 · 657 阅读 · 0 评论 -
poj 2488 A Knight's Journey
一个简单的深搜题。麻烦在于原创 2014-07-07 21:41:24 · 425 阅读 · 0 评论 -
hdu 1518 Square
这题 个人只剪了两次,一是如果所有的转载 2014-07-06 11:14:30 · 501 阅读 · 0 评论 -
hdu1016 Prime Ring Problem
这是shenso#include #include using namespace std;int n,visited[30],buffer[30],ans,flag;bool is_prime(int x,int y){ int sum=x+y; for(int i=2;i*isum;i++) { if(sum%i==0)原创 2014-05-11 13:41:46 · 407 阅读 · 0 评论 -
poj 2965 The Pilots Brothers' refrigerator
一个与poj 1753 类似的题目不过是将改sigefangxia原创 2014-07-08 16:56:46 · 397 阅读 · 0 评论 -
hdu 1175 连连看
本题DFS与BFS都可以就是判断在两次转弯后 能不能找到。。BFS#include #include #include using namespace std;struct node{ int x, y; int t, d;};queue q;int n, m, map[1002][1002], prove;int visit[1002][1002][原创 2014-07-27 11:24:21 · 462 阅读 · 0 评论 -
poj3126Prime Path
就因为在判断素数的时候少个等于号 纠结一天,。。。。#include#include#include#include#include#includeusing namespace std;queue q;int v[10005],c;int yy[10005];int qq(int g){ for(int i=2;i*i<=g;i++) { i原创 2014-07-25 19:46:12 · 492 阅读 · 0 评论 -
hdu 4217Data Structure?
树状数组+二分就是找第几小的数,,找几次,再求和。。#include#include#include#include#includeusing namespace std;const int N=277777;int t,n,m,bit[N],num,i;long long ans;int low(int g){ return g&(-g);}void up原创 2014-07-24 17:06:02 · 672 阅读 · 0 评论 -
poj 2503 Babelfish
一个简单的单词翻译的题,我是使用字典序做的;由于输入的问题 ,,WA,WA,,,都是泪;#include #include #include using namespace std;struct node{ int chile[26]; bool qq; char uu[11]; node() { qq=0;原创 2014-07-19 10:18:48 · 744 阅读 · 0 评论 -
codeforce C. Valera and Elections (DFS)
给你几组数代表那两个城镇有路连接和路的好坏。。要找到最少的从城镇1到x的x集合能把所有的坏的路都找到并修好。。C. Valera and Electionstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutp原创 2014-08-07 10:42:50 · 928 阅读 · 0 评论