码迷,mamicode.com
首页 >  
搜索关键字:zoj bfs    ( 8652个结果
uva 1341 - Different Digits(数论+bfs)
题目链接:uva 1341 - Different Digits 题目大意:给定一个数字n,要求求一个数字m,m可以整除n,并且尽量组成的数字种类(0~9)尽量少,在种类相同的情况下数值尽量小。 解题思路:可以证明两种数字肯定可以组成m,假设有数字k,一种数字可以有k,kk,kkk,kkkk,…整除n剩的数一定在0~n-1之间,所以肯定存在两个由k数字组成的数字同模,那么这两个数相减所...
分类:其他好文   时间:2014-07-23 20:57:35    阅读次数:272
最短路径算法小结
不同性质的图中,所采取的策略有所不同,自然存在各样的求最短路径的算法。* 无向无权图:BFS* 有向正权图:Dijkstra* 有向无负环图:Bellman-Ford(单点),Floyd-Warshall(任意两点)* 有向无环图(dags): 基于动态规划的算法。## 广度优先搜索(BFS)对于无...
分类:其他好文   时间:2014-07-23 20:47:15    阅读次数:261
ZOJ 1806 (小数高精度)
题意:八进制小数转化成十进制的小数。                     0.d1d2d3 ... dk [8] = 0.D1D2D3 ... Dm [10] 例:     0.75 [8] = 7*8^-1+5*8^-2 = ( 5/8 + 7 ) / 8 = 0.953125 [10] 算法:主要就是实现上面的秦九韶算法; 实现:模拟手算除法: #...
分类:其他好文   时间:2014-07-23 17:05:34    阅读次数:202
ZOJ1093 Monkey and Banana 【DP】
一、题目ZOJ 1093二、题目源程序#include //一个箱子有3种h..所以总共有3*n种高度.按面积从大到小排序#include struct block{ int x,y,z,h;}a[200];int cmp(const void *a,const void *b)//快排,模版{ r...
分类:其他好文   时间:2014-07-23 16:55:21    阅读次数:198
ZOJ 1584:Sunny Cup 2003 - Preliminary Round(最小生成树&&prim)
Sunny Cup 2003 - Preliminary Round April 20th, 12:00 - 17:00 Problem E: QS Network In the planet w-503 of galaxy cgb, there is a kind of intelligent creature named QS. QScommunicate with each...
分类:其他好文   时间:2014-07-23 13:14:06    阅读次数:288
zoj 1648 判断线段是否相交
链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=648Circuit BoardTime Limit:2 Seconds Memory Limit:65536 KBOn the circuit board, there ar...
分类:其他好文   时间:2014-07-23 12:24:46    阅读次数:274
[SCOI2007] 修车
属于我的费用流版本终于诞生了!想来还有点小激动呢…看了下模板,之后完全按照自己的想象来写,这样在考场上也不怕啦~某人说其实费用流就是把Dinic里的BFS换成SPFA,似乎还是比较有道理的,就是addflow要做一些修改,我第一次的错误就是addflow里的循环写成了while pre[x]st d...
分类:其他好文   时间:2014-07-23 12:00:17    阅读次数:297
ZOJ 1259 Rails
stack的应用 1 #include 2 #include 3 #include 4 using namespace std; 5 int goal[1005]; 6 int d[1005]; 7 stacks; 8 int main() 9 {10 freopen("input.txt"...
分类:其他好文   时间:2014-07-23 11:57:56    阅读次数:220
HDU1026 Ignatius and the Princess I 【BFS】+【路径记录】
Ignatius and the Princess I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11710    Accepted Submission(s): 3661 Special Judge Problem...
分类:其他好文   时间:2014-07-22 18:00:03    阅读次数:283
zoj1970||poj 1936 All in All
注意细节,一直把Yes,写成YES,找错误找了老半天都找不出来。。。。 代码如下:#include #include int main() { char s[100005],t[100005]; int m,i,j,n; while(scanf("%s%s",s,t)!=EOF) { m=strlen(t); n=strlen(s); i=0; f...
分类:其他好文   时间:2014-07-22 17:59:41    阅读次数:201
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!