码迷,mamicode.com
首页 >  
搜索关键字:DFS Troubleshooting    ( 10753个结果
hdu 4882 ZCC Loves Codefires(贪心)
# include # include # include using namespace std; struct node { int v; int t; }; struct node a[100010]; bool cmp(node a,node b) { return a.v *a.t+(a.v+b.v)*b.t<b.v*b.t+(a.v+b.v)*a.t; }...
分类:其他好文   时间:2014-07-24 23:16:23    阅读次数:268
hdu--1028--dp||递推||母函数
这题开始的时候犯了和做--调皮的小明的时候 一样的错误 去dfs了 果断TLE啊然后想起来 就dp去做...还有一些别的做法 有人用递推 或者 母函数做的 其实递推的话 还是和dp有点像的还有一种 记忆化搜索的方法 太流弊了我把它都贴出来好了 1 /* 2 #include 3 #include ....
分类:其他好文   时间:2014-07-24 22:35:02    阅读次数:222
HDU 1142 A Walk Through the Forest(dijkstra+记忆化DFS)
题意: 给你一个图,找最短路。但是有个非一般的的条件:如果a,b之间有路,且你选择要走这条路,那么必须保证a到终点的所有路都小于b到终点的一条路。问满足这样的路径条数 有多少,噶呜~~题意是搜了解题报告才明白的Orz.。。。英语渣~思路: 1.1为起点,2为终点,因为要走ab路时,必须保证那个条件....
分类:其他好文   时间:2014-07-24 22:06:22    阅读次数:196
poj 2034 Anti-prime Sequences(dfs)
//相邻的 2.3......d 之和都要不为素数 # include # include using namespace std; int num[1010],vis[1010]; int n,m,d,cot; int flag[10010]; void init()//素数打表 { int i,j; for(i=2;i<10010;i++) { if(!flag[i]) f...
分类:其他好文   时间:2014-07-24 11:32:42    阅读次数:234
URAL 1033 Labyrinth(DFS)
Administration of the labyrinth has decided to start a new season with new wallpapers. For this purpose they need a program to calculate the surface area of the walls inside the labyrinth. This job ...
分类:其他好文   时间:2014-07-23 22:32:07    阅读次数:292
poj1321 基础DFS
最近两天在写搜索专题题意:中文题就不用讲题意思路:由于每行每列只允许最多一个棋子,那么我们可以从第一行开始往下搜索,并标记列,如果这列放了就不放,否则就放,并向下层搜索,这样可以不用标记行了。#include#includeint n,sum,m;const int maxn = 10;char m...
分类:其他好文   时间:2014-07-23 22:16:37    阅读次数:264
poj 1699 Best Sequence (搜索技巧 剪枝 dfs)
题目链接题意:给出几个基因片段,要求你将它们排列成一个最短的序列,序列中使用了所有的基因片段,而且不能翻转基因。分析:先计算出add数组,再dfs枚举。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7...
分类:其他好文   时间:2014-07-23 22:11:17    阅读次数:281
hdu 1258 Sum It Up(dfs)
# include # include using namespace std; int flag,t,n,a[10010],cot[10010],vis[100010]; void dfs(int x,int sum,int count) { int i; if(sum>t) return ; else if(sum==t) { for(i=0;i<count;i++)...
分类:其他好文   时间:2014-07-23 21:04:53    阅读次数:211
hdu--1027-next_permutation||dfs
....连跪3把 真无语..写完这个 看电影去了..明天就去看 后会无期了 应该不会让人失望的-------------碎碎念这题 我一开始自己是用 dfs写的.. 后来看了下discuss 看到个新方法 使用stl中的next_permuntation 速度不仅快了许多 而且代码简洁..关于 这个...
分类:其他好文   时间:2014-07-23 20:50:05    阅读次数:196
POJ 1392 Ouroboros Snake 欧拉回路
和那个编码是差不多的题,同样是分别用dfs和手写栈写了一遍,练手这次写的时候比上次思路更加清晰了。#include #include #include #include #include #include #include #include #include #include #include #i...
分类:其他好文   时间:2014-07-23 20:31:25    阅读次数:157
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!