- 博客(79)
- 资源 (1)
- 收藏
- 关注
原创 【专辑】图论复习
http://blog.csdn.net/tclh123/article/details/6407352updating ... 05.09...08.08...10.28... 存图方法。零、连通性 无向图割点、桥 有向图强连通SCC一、最短路Dijkstra +heapB
2013-05-29 21:07:04 916
原创 分治法最近点对问题
在二维平面上的n个点中,如何快速的找出最近的一对点,就是最近点对问题。 一种简单的想法是暴力枚举每两个点,记录最小距离,显然,时间复杂度为O(n^2)。 在这里介绍一种时间复杂度为O(nlognlogn)的算法。其实,这里用到了分治的思想。将所给平面上n个点的集合S分成两个子集S1和S2,每个子集中约有n/2个点。然后在每个子集中递归地求最接近的点对。在这里,一个关键的
2013-05-29 20:53:20 4165
原创 母函数详解
母函数(Generating function)详解在数学中,某个序列的母函数是一种形式幂级数,其每一项的系数可以提供关于这个序列的信息。使用母函数解决问题的方法称为母函数方法。母函数可分为很多种,包括普通母函数、指数母函数、L级数、贝尔级数和狄利克雷级数。对每个序列都可以写出以上每个类型的一个母函数。构造母函数的目的一般是为了解决某个特定的问题,因此选用何种母函数视乎序列本身
2013-05-28 22:19:51 2314
原创 母函数
定义 [编辑]母函数就是一列用来展示一串数字的挂衣架— 赫伯特·维尔夫, [1]普通母函数 [编辑]普通母函数就是最常见的母函数。一般来说,序列的母函数是:如果 是某个离散随机变量的概率质量函数,那么它的母函数被称为一个概率母函数。多重下标的序列也可以有母函数。例如,序列 的母函数是。指数母函数 [编辑]
2013-05-22 13:47:26 1268
原创 二分图——最大匹配数(最小覆盖数)、最大独立数、最小路径覆盖、带权最优匹配
文本内容框架:§1图论点、边集和二分图的相关概念和性质§2二分图最大匹配求解匈牙利算法、Hopcroft-Karp算法§3二分图最小覆盖集和最大独立集的构造§4二分图最小路径覆盖求解§5二分图带权最优匹配求解Kuhn-Munkers算法§6小结每章节都详细地讲解了问题介绍,算法原理和分析,算法流程,算法实现四部分内容,力求彻底
2013-05-19 17:04:52 3029
原创 图论模版
转载于http://blog.acmol.com邻接表求强连通分量Tarjan求双连通分量Tarjan最近公共祖先Tarjan最短路SPFA最短路dijkstra优先队列优化最短路Floyd最短路/负权回路判定Bellman最小生成树prim优先队列优化并查集最小生成树Kruskal二分图匹配二分图多重匹配网络流ISAP算法最小费用最大流欧拉路的判断求欧拉路圈套圈算法拓扑排序
2013-05-17 15:05:54 945
原创 映射二叉堆
适妞namespace MappingBinaryHeap{/* DS: Datastructure to show the value Heap: 1.Ds:value 2.idx:index pos: The position for each index len: The v
2013-05-17 14:54:30 1680
原创 POJ 图论
POJ 2449 Remmarguts' Date(中等) AChttp://acm.pku.edu.cn/JudgeOnline/problem?id=2449题意:经典问题:K短路解法:dijkstra+A*(rec),方法很多相关:http://acm.pku.edu.cn/JudgeOnline/showcontest?contest_id=1144
2013-05-09 22:17:42 5605 1
原创 图论知识点列表
基本图算法图广度优先遍历深度优先遍历拓扑排序割边割点强连通分量Tarjan算法双连通分量强连通分支及其缩点图的割边和割点最小割模型、网络流规约2-SAT问题欧拉回路哈密顿回路最小生成树Prim算法Kruskal算法(稀疏图)Sollin算法次小生成树第k小生成树最优比例生成树最小树形图最小度限制生成树平面点的欧
2013-05-07 11:59:55 1091
原创 hdu1030-Delta-wave
http://acm.hdu.edu.cn/showproblem.php?pid=1030数学题,确定层数差 a1 ,还有左差(从三角形的左边排列看属于第几层的差)b1 ,右差c1;最后求和即可#include#include#include#includeusing namespace std ;int main(){ int n , m ; while( ci
2013-05-31 16:45:42 960
原创 C++STL的next_permutation
在标准库算法中,next_permutation应用在数列操作上比较广泛.这个函数可以计算一组数据的全排列.但是怎么用,原理如何,我做了简单的剖析.首先查看stl中相关信息.函数原型:template bool next_permutation( BidirectionalIterator _First, BidirectionalIter
2013-05-31 16:05:26 905
原创 hdu1027-Ignatius and the Princess II
http://acm.hdu.edu.cn/showproblem.php?pid=1027使用了next_permutation()函数#include#include#include#include#includeusing namespace std;const int maxn = 100005 ;int num[ maxn ] ;int main(){
2013-05-31 16:02:39 1035
原创 hdu1025-Constructing Roads In JGShining's Kingdom
http://acm.hdu.edu.cn/showproblem.php?pid=1025最长上升子序列(长度)#include#include#includeusing namespace std; int n ;const int maxn = 500005 ;int dp[ maxn ] , a[ maxn ];int LIS(int n ){ int low
2013-05-31 13:39:47 971
原创 hdu1022-Train Problem I
http://acm.hdu.edu.cn/showproblem.php?pid=1022#include#include#include#includeusing namespace std;int main(){ int n ; int vis[ 1005 ] ; char a[ 1005 ] , b[ 1005 ] ; while( cin >> n >> a >
2013-05-30 20:25:18 876
原创 hdu1017-A Mathematical Curiosity
http://acm.hdu.edu.cn/showproblem.php?pid=1017代码格式及其恶心,记录一下#include#include#includeusing namespace std ;int main(){ int i , j , sum ,Case , n , m ; scanf( "%d" , &Case ) ; { //printf(
2013-05-30 19:48:25 896
原创 hdu1016-Prime Ring Problem
http://acm.hdu.edu.cn/showproblem.php?pid=1016#include#include#includeusing namespace std ;int n ;int union_prime( int x ){ for( int i = 2 ; i < x ; ++i ) if( x % i == 0 ) return 0 ; r
2013-05-30 19:11:36 851
原创 hdu1007-Quoit Design
http://acm.hdu.edu.cn/showproblem.php?pid=1007#include#include#include#include#includeusing namespace std ;const int maxn = 1000001 ;const int INF = 1000000001 ;struct Point{ double x ,
2013-05-29 20:43:55 999
原创 hdu1085-Holding Bin-Laden Captive!
http://acm.hdu.edu.cn/showproblem.php?pid=1085#include#include#includeusing namespace std;int num[ 10 ] ;int c1[ 100000 ] , c2[ 100000 ] ;int main(){ int i , j , k ; while( cin >> num[ 1
2013-05-29 13:40:10 1304
原创 hdu1398-Square Coins
http://acm.hdu.edu.cn/showproblem.php?pid=1398#include#include#includeusing namespace std ;const int maxn = 305 ;int c1[ maxn ] , c2[ maxn ] ;int main(){ int n ; int i , j , k ; while(
2013-05-29 12:53:51 1154
原创 hdu1028-Ignatius and the Princess III
http://acm.hdu.edu.cn/showproblem.php?pid=1028#includeusing namespace std; const int _max = 121;//c1是保存各项质量砝码可以组合的数目//c2是中间量,保存没一次的情况int c1[_max], c2[_max]; int main(){ //int n,i,j,k;
2013-05-29 12:36:48 1592
原创 hdu4451-Dressing
http://acm.hdu.edu.cn/showproblem.php?pid=4451以下用了两种思路求解, 另外用了数组用set两种写法,3份代码,另外还有一种思路的数组方法没有写,感兴趣的朋友们可以尝试下;A; 使用两个数组,左侧存和裤子不匹配的情况,右边统计鞋子和裤子不匹配的情况,然后求解每项的 ( n - lw[ i ] ) * ( k -
2013-05-24 16:30:27 953
原创 hdu4450-Draw Something
http://acm.hdu.edu.cn/showproblem.php?pid=4450不多说// File Name: hdu4450.cpp// Author: bo_jwolf// Created Time: 2013年05月24日 星期五 14:33:25#include#include#include#include#include#include#i
2013-05-24 14:30:50 1131
原创 hdu4445-Crazy Tank
http://acm.hdu.edu.cn/showproblem.php?pid=4445直接使用速度公式求解,采用的是使用枚举三角函数值来计算; 由发射塔到地面的速度公式为 v0 * v0 - vy * vy = 2 * g * h ( v0 为末速度,均为竖直方向的速度 )
2013-05-24 14:26:46 1192
原创 hdu4442-Physical Examination
http://acm.hdu.edu.cn/showproblem.php?pid=4442题目统计最短时间,只需要判断 t + a1 + a2 + t * b1 + t * b2 + a1 * b2 和 t + a1 + a2 + t * b1 + t * b2 + a2 * b1 大小来排列 ; 约分,就是
2013-05-24 12:11:18 1210
原创 hdu2079-选课时间(题目已修改,注意读题)
http://acm.hdu.edu.cn/showproblem.php?pid=2079// File Name: hdu2079.cpp// Author: bo_jwolf// Created Time: 2013年05月23日 星期四 17:05:36#include#include#include#include#include#include#includ
2013-05-23 17:18:23 1259
原创 hdu2080夹角有多大II
http://acm.hdu.edu.cn/showproblem.php?pid=2080就是一道数学题目,然后调用了反三角函数,考虑四个坐标系的情况,考虑清楚即可#include "stdio.h"#include "string.h"#include "stdlib.h"#include "math.h"#include "algorithm"#include "ios
2013-05-23 12:19:54 1089
原创 hdu2076-夹角有多大(题目已修改,注意读题)
http://acm.hdu.edu.cn/showproblem.php?pid=2076按照不同单位转一圈,然后转换成某一个统一的单位换算即可#include "stdio.h"#include "string.h"#include "stdlib.h"#include "math.h"#include "algorithm"#include "iostream"usin
2013-05-22 21:47:24 1954
原创 hdu2087-剪花布条
http://acm.hdu.edu.cn/showproblem.php?pid=2087stl_strng#include#include#includeusing namespace std ;int main(){ int temp , sum ; string str1 , str2 ; while( cin >> str1 && str1 != "#" )
2013-05-22 19:57:27 1240
原创 hdu2098-分拆素数和
http://acm.hdu.edu.cn/showproblem.php?pid=2098网上另一种代码多的是,有兴趣的自己看看吧,这道题目明显想复杂了,数据不是很大,却用了打表;#include "stdio.h"#include "string.h"#include "stdlib.h"#include "math.h"#include "algorithm"#incl
2013-05-22 18:37:15 1577 2
原创 hdu2083-简易版之最短距离
http://acm.hdu.edu.cn/showproblem.php?pid=2083#include "stdio.h"#include "string.h"#include "stdlib.h"#include "math.h"#include "algorithm"#include "iostream"using namespace std;#define ma
2013-05-22 13:30:29 1090
原创 hdu2082-找单词
http://acm.hdu.edu.cn/showproblem.php?pid=2082背包问题,开个二位数组,第一维表示第几个字母数,第二维表示分数,然后统计计算出题目要求的小于50的即可;最后从1~50中的统计个数#include "stdio.h"#include "string.h"#include "stdlib.h"#include "math.h"#inc
2013-05-22 13:12:49 1441
原创 hdu2078-复习时间
http://acm.hdu.edu.cn/showproblem.php?pid=2078#include "stdio.h"#include "string.h"#include "stdlib.h"#include "math.h"#include "algorithm"#include "iostream"using namespace std;const int
2013-05-22 12:40:39 1327
原创 hdu1134-Game of Connections
http://acm.hdu.edu.cn/showproblem.php?pid=1134catalan数#include "stdio.h"#include "string.h"#include "stdlib.h"#include "math.h"#include "algorithm"#include "iostream"using namespace std;
2013-05-21 21:07:21 1037
原创 hdu1130-How Many Trees?
http://acm.hdu.edu.cn/showproblem.php?pid=1130catalan数#include "stdio.h"#include "string.h"#include "stdlib.h"#include "math.h"#include "algorithm"#include "iostream"using namespace std
2013-05-21 21:03:46 1120
原创 hdu1023-Train Problem II
http://acm.hdu.edu.cn/showproblem.php?pid=1023卡特兰数#include "stdio.h"#include "string.h"#include "stdlib.h"#include "math.h"#include "algorithm"#include "iostream"using namespace std;co
2013-05-21 21:02:06 910
原创 hdu2067-小兔的棋盘
http://acm.hdu.edu.cn/showproblem.php?pid=2067如图所示 , 矩阵关于y = - x 即 x == y对称, 因此只需要算出其中的一半,然后乘二即可 ,第一行所有的数据均只能由左边传递过来 ,因此dp[ 0 ][ j ] =1 ;其他的路径均可以通过上和左边传递过来,因此dp[ I ][ j ] = dp[ i - 1][ j ] + dp[
2013-05-21 18:46:02 1295
原创 hdu2086-A1 = ?
http://acm.hdu.edu.cn/showproblem.php?pid=2086推出公式为( n + 1 ) * a1 + 2 * ( c1 + c1+c2+cq+c2+c3+......+cn) = n * a0 + an #include "stdio.h"#include "string.h"#include "stdlib.h"#include "math.
2013-05-21 18:07:54 1032
原创 由开锁智力题得出一种求平方数的方法
题目: 在一条长长的走廊上依次排列着100把锁着的锁头。你从把这100把锁全部打开开始(第1遍)。然后,你把所有序号是2的倍数的锁头再锁上(第2遍)。接下来,你依次走到所有序号是3的倍数的锁头前,如果它是打开的,就把它锁上;如果它是锁上的,就把它打开——我们把这称为“切换锁头的状态”(第3遍)。你继续像这样在第N遍去切换所有序号是N的倍数的锁头的状态。当进行到第100遍时,你将只切换第100把锁头
2013-05-21 16:46:47 1207
原创 hdu4435-charge-station
http://acm.hdu.edu.cn/showproblem.php?pid=4435bfs搜索大致题意是 给出N个点,让你选择性地建立加油站,在第i个点建立加油站的费用为2^i-1,要使自己能从1号点经过所有点回到原点,点可以重复经过,加油费用不计,每次加油最多能跑的距离为D。输出的答案是2进制,由费用10进制转化过来就是在第i个点建立加油站,答案从右往
2013-05-21 16:30:26 1682
原创 hdu4438 - Hunters
http://acm.hdu.edu.cn/showproblem.php?pid=4438分情况讨论:A:表示Alice打tiger时 :a、Bob打tiger的概率为q , 那么得分为 q * (1 - p ) * p * x + q * p * p * x + q * ( 1 - p ) * p * y + q * p * p* y ; ;b、Bpb打wolf的概率为
2013-05-21 13:57:21 1268
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人