- 博客(10)
- 资源 (1)
- 收藏
- 关注
原创 poj1010 枚举
/*枚举出所有情况,在枚举的过程中,选出最优解。大致题意:1、满足客户要求的即为可行解 2、种类最多即为最优解 3、在种类相同的情况下,张数少的更优 4、在张数相等的情况下,单个价值更大的更优 5、三者都相同,输出tie*/#include #include #include using namespace std;int stamp[1006];int s[4];int n,m,k,
2012-04-26 21:40:00 343
转载 poj1010搜索
问题重述: 给出n种邮票,每种邮票有自己的面值(面值可能重复) 指定m种“总面值”,对每种“总面值”,求解满足如下条件的组合以达到该“总面值”(1) 所用邮票在n种中可以重复选取(2) 所用邮票张数〈=4(3) 尽量多的使用那个不同种类的邮票 Max (Stamp Types)(4) 若
2012-04-25 20:35:06 307
转载 poj搜索汇总
1010 stamps1011 sticks Accepted 1020 Anniversary Cake1022 Packing Unit 4D Cubes1024 Tester Program1054 The Troublesome Frog1062 昂贵的聘礼1069 The Bermuda Triangle1072 Puzzle Out1077 Eigh
2012-04-23 20:06:32 328
原创 poj1125最短路模板
简单的模板应用,就是求图中各个点中,每个点到其余各点最大距离的最小值。#include #include #include using namespace std;#define maxn 110#define maxint 999999int mapp[maxn][maxn];//the map of the problemint ans[maxn];//the longest d
2012-04-23 19:14:47 278
原创 poj3461KMP算法模板
#include #include #include using namespace std;char a[1000010],b[1001000];int next[1001000];int n,m;void GetNext(char ch[],int next[]){ int i=1,j=0; next[1]=0; next[0]=0; while
2012-04-23 10:55:56 232
转载 zju搜索题目、图论题目
Group 11: 搜索初步深度优先搜索和广度优先搜索是属于常用的搜索技术。前者用到递归,后者涉及队列。深度优先搜索对于解决某些问题并不一定是最好的,但很容易实现,有时也十分有效,它的难点在于如何剪枝优化。出现在递归初步中的题目可以算是深搜的一种。广度优先搜索技术的结构相对固定,但节点的判重也是个难点。由于时间效率的原因,广度优先搜索运用得更为广泛。下面是关于它们的一些练习。编
2012-04-19 20:04:44 624
原创 poj1101广搜
我的个神啊,怎么过都过不去,我都疯掉了!第一种是我觉得没有问题,但是怎么过不去的,烦请各位路过大神们帮忙看一下。第二种是一个特暴的广搜,都可以过去,无奈ing#include using namespace std;const int Pow2[4]={1,2,4,8};struct State{ int r,c;};int w,h;char board[78][78];
2012-04-18 21:05:23 592
原创 以hdu1241为例,区分dfs和bfs
#include #include using namespace std;const int maxn=110;char mapn[maxn][maxn];int m,n,count;int dir[8][2]={{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1},{1,0},{1,1}};void bfs(int a,int b){ m
2012-04-09 21:23:59 316
原创 poj1701
#include using namespace std;int t,m,a,b;int K[10001],sumK[10001];__int64 dD,c;int ans;int main(){ int i; cin>>t; while(t--) { cin>>m>>a>>b; cin>>K[1];c=sumK[1
2012-04-04 20:23:16 374
原创 poj1676模拟
#include using namespace std;const int LCD[10][9]={ {0,1,0,1,0,1,1,1,1}, {0,0,0,0,0,1,0,0,1}, {0,1,0,0,1,1,1,1,0}, {0,1,0,0,1,1,0,1,1}, {0,0,0,1,1,1,0,0,1}, {0,1,0,1,1,0,0,
2012-04-04 17:40:17 466
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人