07 2014 档案

摘要:1.概念 生成函数即母函数,是组合数学中尤其是计数方面的一个重要理论和工具。生成函数有普通型生成函数和指数型生成函数两种,其中普通型用的比较多。形式上说,普通型生成函数用于解决多重集的组合问题,而指数型母函数用于解决多重集的排列问题。母函数还可以解决递归数列的通项问题(例如使用母函数解决斐波那契数... 阅读全文
posted @ 2014-07-31 08:12 Enumz 阅读(1348) 评论(3) 推荐(3)
摘要:算法总结之欧拉函数&中国剩余定理1.欧拉函数 概念:在数论,对正整数n,欧拉函数是少于或等于n的数中与n互质的数的数目。 通式:φ(x)=x(1-1/p1)(1-1/p2)(1-1/p3)(1-1/p4)…..(1-1/pn) 其中p1, p2……pn为x的所有质因数,x是不为0的整数 ... 阅读全文
posted @ 2014-07-30 17:37 Enumz 阅读(2152) 评论(0) 推荐(3)
摘要:BiorhythmsDescription人生来就有三个生理周期,分别为体力、感情和智力周期,它们的周期长度为23天、28天和33天。每一个周期中有一天是高峰。在高峰这天,人会在相应的方面表现出色。例如,智力周期的高峰,人会思维敏捷,精力容易高度集中。因为三个周期的周长不同,所以通常三个周期的高峰不... 阅读全文
posted @ 2014-07-30 16:42 Enumz 阅读(281) 评论(0) 推荐(0)
摘要:Big Event in HDUDescriptionNowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don't know that Computer Colle... 阅读全文
posted @ 2014-07-30 16:30 Enumz 阅读(210) 评论(0) 推荐(1)
摘要:算法总结之欧几里德算法1.欧几里德算法 欧几里德算法又称辗转相除法,用于计算两个正整数a,b的最大公约数。 其计算原理依赖于下面的定理: gcd(a,b)=gcd(b,amodb)(a>b且amodb不为0)代码实现:1 int gcd(int a,int b)2 {3 return ... 阅读全文
posted @ 2014-07-28 17:25 Enumz 阅读(1162) 评论(0) 推荐(3)
摘要:青蛙的约会Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一... 阅读全文
posted @ 2014-07-28 16:49 Enumz 阅读(199) 评论(1) 推荐(2)
摘要:Restoring IPv6DescriptionAn IPv6-address is a 128-bit number. For convenience, this number is recorded in blocks of 16 bits in hexadecimal record, the... 阅读全文
posted @ 2014-07-27 18:10 Enumz 阅读(482) 评论(0) 推荐(0)
摘要:Pocket BookDescriptionOne day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m ... 阅读全文
posted @ 2014-07-27 18:03 Enumz 阅读(432) 评论(0) 推荐(1)
摘要:逃生Description糟糕的事情发生啦,现在大家都忙着逃命。但是逃命的通道很窄,大家只能排成一行。现在有n个人,从1标号到n。同时有一些奇怪的约束条件,每个都形如:a必须在b之前。同时,社会是不平等的,这些人有的穷有的富。1号最富,2号第二富,以此类推。有钱人就贿赂负责人,所以他们有一些好处。负... 阅读全文
posted @ 2014-07-27 17:54 Enumz 阅读(270) 评论(0) 推荐(0)
摘要:拓扑排序1.一般应用 拓扑排序常用来确定一个依赖关系集中,事物发生的顺序。例如,在日常工作中,可能会将项目拆分成A、B、C、D四个子部分来完成,但A依赖于B和D,C依赖于D。为了计算这个项目进行的顺序,可对这个关系集进行拓扑排序,得出一个线性的序列,则排在前面的任务就是需要先完成的任务。2.实现... 阅读全文
posted @ 2014-07-27 17:35 Enumz 阅读(14493) 评论(0) 推荐(1)
摘要:Floyd算法 Floyd算法可以用来解决任意两个顶点之间的最短路径问题。 核心公式为: Edge[i][j]=Min{Edge[i][j],Edge[i][k]+Edge[k][j]}。 即通过对i,j两个顶点之间插入顶点后比较路径的大小来进行松弛。 首先我们来定义一个二维数组E... 阅读全文
posted @ 2014-07-25 17:33 Enumz 阅读(1161) 评论(1) 推荐(5)
摘要:Blue JeansDescriptionThe Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hund... 阅读全文
posted @ 2014-07-25 12:12 Enumz 阅读(258) 评论(0) 推荐(1)
摘要:FroggerDescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans ... 阅读全文
posted @ 2014-07-24 15:57 Enumz 阅读(226) 评论(1) 推荐(0)
摘要:Cow ContestDescriptionN (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code bet... 阅读全文
posted @ 2014-07-24 15:42 Enumz 阅读(314) 评论(0) 推荐(0)
摘要:WormholesDescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it i... 阅读全文
posted @ 2014-07-24 15:15 Enumz 阅读(224) 评论(-1) 推荐(0)
摘要:ArbitrageDescriptionArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of th... 阅读全文
posted @ 2014-07-24 15:02 Enumz 阅读(283) 评论(0) 推荐(0)
摘要:The Fewest CoinsDescriptionFarmer John has gone to town to buy some farm supplies. Being a very efficient man, he always pays for his goods in such a ... 阅读全文
posted @ 2014-07-24 14:52 Enumz 阅读(257) 评论(0) 推荐(0)
摘要:邻接表 邻接矩阵来存储图的信息相对于非完全图,会浪费大量的空间,同时在求最短路径的时候也会有多余的计算浪费时间。 使用邻接表可以节约这些浪费的时间。 这里介绍的是用数组模拟的邻接表: 定义begin[MAXN],end[MAXN],dis[MAXN],first[MAXN],next[MAX... 阅读全文
posted @ 2014-07-23 14:35 Enumz 阅读(950) 评论(0) 推荐(0)
摘要:SPAF算法求单源最短路的SPFA算法的全称是:Shortest Path Faster Algorithm,该算法是西南交通大学段凡丁于1994年发表的。它可以在O(kE)的时间复杂度内求出源点到其他所有点的最短路径。其中k为所有顶点进队的平均次数,可以证明k一般小于等于2,可以处理负边,但无法处... 阅读全文
posted @ 2014-07-23 11:55 Enumz 阅读(391) 评论(0) 推荐(0)
摘要:Bellman-Ford算法Dijkstra算法无法判断含负权边的图的最短路。如果遇到负权,在没有负权回路存在时,即便有负权的边,也可以采用Bellman-Ford算法正确求出最短路径。PS:负权回路的含义是,回路的权值和为负。算法描述1.初始化:将除源点外的所有顶点的最短距离估计值d[v]←+∞,... 阅读全文
posted @ 2014-07-23 11:51 Enumz 阅读(283) 评论(0) 推荐(0)
摘要:Dijkstra算法 Dijkstra算法主要特点是以起始点为中心向外层层扩展,直到扩展到终点为止。 注意该算法要求图中不存在负权边。 首先我们来定义一个二维数组Edge[MAXN][MAXN]来存储图的信息。 这个图的Edge数组初始化以后为 我们还需要用一个一维数组dis来存储... 阅读全文
posted @ 2014-07-23 11:45 Enumz 阅读(250) 评论(0) 推荐(0)
摘要:Invitation CardsDescriptionIn the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this f... 阅读全文
posted @ 2014-07-22 16:48 Enumz 阅读(725) 评论(1) 推荐(0)
摘要:A strange liftDescriptionThere is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 2 #include 3 #include 4... 阅读全文
posted @ 2014-07-22 15:51 Enumz 阅读(348) 评论(0) 推荐(0)
摘要:Borg MazeDescriptionThe Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the ter... 阅读全文
posted @ 2014-07-20 20:48 Enumz 阅读(195) 评论(0) 推荐(0)
摘要:QS NetworkDescriptionIn the planet w-503 of galaxy cgb, there is a kind of intelligent creature named QS. QScommunicate with each other via networks. ... 阅读全文
posted @ 2014-07-20 15:01 Enumz 阅读(297) 评论(0) 推荐(0)
摘要:Additive equationsDescription We all understand that an integer set is a collection of distinct integers. Now the question is: given an integer set... 阅读全文
posted @ 2014-07-20 14:47 Enumz 阅读(403) 评论(0) 推荐(0)
摘要:畅通工程再续Description相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合... 阅读全文
posted @ 2014-07-19 17:11 Enumz 阅读(644) 评论(2) 推荐(1)
摘要:Double HappinessOn the math lesson a teacher asked each pupil to come up with his own lucky numbers. As a fan of number theory Peter chose prime numbe... 阅读全文
posted @ 2014-07-17 19:09 Enumz 阅读(401) 评论(0) 推荐(0)
摘要:Children of the Candy CornDescriptionThe cornfield maze is a popular Halloween treat. Visitors are shown the entrance and must wander through the maze... 阅读全文
posted @ 2014-07-16 11:35 Enumz 阅读(207) 评论(0) 推荐(0)
摘要:Labeling BallsDescriptionWindy has N balls of distinct weights from 1 unit to N units. Now he tries to label them with 1 to N in such a way that:No tw... 阅读全文
posted @ 2014-07-15 10:27 Enumz 阅读(275) 评论(0) 推荐(1)
摘要:Greatest Number题目描述Saya likes math, because she think math can make her cleverer.One day, Kudo invited a very simple game:Given N integers, then the p... 阅读全文
posted @ 2014-07-14 14:50 Enumz 阅读(271) 评论(0) 推荐(1)
摘要:TreeYou are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the bin... 阅读全文
posted @ 2014-07-13 10:42 Enumz 阅读(1572) 评论(0) 推荐(1)
摘要:Red and BlackProblem DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on... 阅读全文
posted @ 2014-07-13 10:27 Enumz 阅读(343) 评论(0) 推荐(0)