摘要: 简单搜索题:#include<iostream>#include<cstdio>#include<cstring>using namespace std;class Node{public: int x,y;};Node queue[424];int d[4][2]={0,-1,1,0,0,1,-1,0};char map[24][24];int BFS( int x, int y ){ int end =0 ,first = 0; Node t; t.x = x; t.y = y; queue[end]=t; end++; while( first < 阅读全文
posted @ 2012-02-28 22:20 wutaoKeen 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 该题用到二分的方法:#include<iostream>#include<algorithm>#include<cstdio>using namespace std;class Node{public: int h,w; };bool cmp( Node a ,Node b ){ if( a.w == b.w ) return a.h > b.h; return a.w < b.w; }Node doll[20024];int Doll( int n ){ int sum=0; int hash[20024]={0}; for( int i = 阅读全文
posted @ 2012-02-28 20:50 wutaoKeen 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 该题用广搜比较好,这里要处理好就是X*2的时候,我们知道如果一步一步地走也就最多终点与起点相减的绝对值,那么我们就不能超过终点加上他们的绝对值;#include<iostream>#include<cstdio>#include<cstring>using namespace std;class Node{public: int time,number;};Node queue[200024];int BFS( int A, int B ){ bool hash[200024]={0}; int dis = abs( A - B ); int first=0 阅读全文
posted @ 2012-02-28 19:38 wutaoKeen 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 一道典型的搜索题。#include<iostream>#include<cstdio>#include<cstring>using namespace std;char map[124][124];int n,m;int d[8][2] = { -1,-1,0,-1,1,-1,-1,0,1,0,-1,1,0,1,1,1 };void DFS( int x, int y ){ for( int i = 0 ; i< 8 ; i++ ) { int dx = x + d[i][0]; int dy = y + d[i][1]; if( map[dx][dy 阅读全文
posted @ 2012-02-28 18:53 wutaoKeen 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 该题是一道,成段更新,单点查询(简单线段树+简单DP),这个题与http://poj.org/problem?id=1436思想差不多,这里我就不重复了,这里就是要处理最大值的问题也就是DP;我有的方法就是以该条边的两个端点往下搜索,如果下面有可见的边,选择值的那条边,然后再进行更新;#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>using namespace std;class Node{public: int l ,r , sum,cover; }; 阅读全文
posted @ 2012-02-28 15:22 wutaoKeen 阅读(218) 评论(0) 推荐(0) 编辑