avatar
fireworks99
keep hungry keep foolish
马航MH370 五年等待 未见归期

马航MH370失联

2014年3月8日凌晨,马航MH370号班机从吉隆坡国际机场起飞,机上共载有239人,其中有154名中国人(中国大陆153人,中国台湾1人)。

该班机原定计划于北京时间早晨6:30抵达北京首都国际机场,但起飞后不足一小时便在马来西亚与越南海域的交界处,土珠岛以南约140海里及哥打巴鲁东北东约90海里处与马国梳邦空管中心(空中交通管制中心)失去联系。

Read more -->
HDU 1875 畅通工程再续

最小生成树

最小生成树是一副连通加权无向图中一棵权值最小的生成树

主要可以使用Prim和Kruskal算法(借助并查集)实现

稠密图、点少边多:Prim

稀疏图、边多点少:Kruskal

Read more -->
HDU 1232 畅通工程

关于并查集

并查集,在一些有N个元素的集合应用问题中,我们通常是在开始时让每个元素构成一个单元素的集合,然后按一定顺序将属于同一组的元素所在的集合合并,其间要反复查找一个元素在哪个集合中。

特点是看似并不复杂,但数据量极大 。

是一种树型的数据结构,用于处理一些不相交集合(Disjoint Sets)的合并及查询问题 。

Read more -->
组合数与第二类斯特林数

求解组合数 C(n,m)

暂时有三种方法:

1.存在数组里递归求解

2.较为生猛地求解(连乘连除)

3.改良版(乘一次除一次)

Read more -->
SDNUOJ 1089 拓扑排序

Description

给定一个有向图,若图无环,则将其进行拓扑排序并输出,否则输出IMPOSABLE。

Input

第一行为两个整数n(1<=n<=1000)、m(1<=m<=100000); 之后m行,每行两个整数a、b(0 < a, b <= n)表示一条从a到b的有向边。

Read more -->
SDNUOJ 1223 Tom's problem A

Description

In the future ,One day, tom feel so happy ,because he have a date with a girl,but they don’t live in the same city , so tom want you help him find the fastest way to the girl’s city,You should note that with the development of technology, transport can go beyond the speed of light, so the time you spend would be less than zero, but if you return to the past you can not have the date with the girl,there n(1<n<=100) city in this country and three are m(1<m<1000) roads in this country;

Read more -->
素数筛

筛法求素数

用筛法求素数的基本思想是:把从1开始的、某一范围内的正整数从小到大顺序排列, 1不是素数,首先把它筛掉。剩下的数中选择最小的数是素数,然后去掉它的倍数。依次类推,直到筛子为空时结束。

Read more -->
spfa算法

spfa算法(优化)

spfa算法通常用于求含负权边的单源最短路径,以及判负权环。

允许输入有重边(Dijkstra不可)

Read more -->
树状数组 解 POJ 2299 Quick-Sort

Description

In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending order. For the input sequence 9 1 0 5 4 ,

Read more -->
链式前向星

链式前向星

链式前向星对于图的存储十分方便,我们可以对一个节点进行访问,遍历所有与他相连的边,从而访问与它临近的所有节点,比如说在bfs版本的spfa实现最短路时,就有很好的应用。

与邻接矩阵、邻接表不同的是,存的是“边”

Read more -->
Site by Baole Zhao | Powered by Hexo | theme PreciousJoy