图论
u010912405
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
hdu1010 深搜+减枝
此题很明显是深度优先搜索问题,不过需要减枝还有回溯。 #include #include #include using namespace std; const int NP=9; char map[NP][NP]; int sx,sy,dx,dy; int flag; int m,n,t; int ds[4][2]={0,1,1,0,0,-1,-1,0}; void dfs(int x,int原创 2013-08-19 17:22:27 · 425 阅读 · 0 评论 -
hdu1869 floyd算法
本题使用floyd求出任意两点之间的距离,然后求出任意两点之间的距离是否 #include #include #include using namespace std; const int NP=102; const int INF=0x0fffffff; int map[NP][NP]; int N,M; void init() { for(int i=0;i<N;i++)原创 2013-08-20 10:45:15 · 417 阅读 · 0 评论 -
hdu1016深搜
#include #include #include using namespace std; const int N=21; int n,ans[100],visited[30]; int prime(int m) { //int k=(int)sqrt(m);//一直wa! for(int i=2;i<=m/2;i++) { if原创 2013-08-20 20:46:50 · 482 阅读 · 0 评论 -
hdu1026 优先队列+广搜
#include #include #include #include using namespace std; struct node { int x,y; int step; friend bool operator<(node a,node b) { return b.step<a.step;原创 2013-08-24 13:57:26 · 553 阅读 · 0 评论 -
hdu1035
#include #include #include using namespace std; const int N=11; int m,n,p; char map[N][N]; int a[N][N]; struct Point { int x; int y; // int step; // int visited; }point[N*N];原创 2013-08-29 12:31:57 · 480 阅读 · 0 评论
分享