- 博客(44)
- 资源 (1)
- 收藏
- 关注
原创 POJ-2983-Is the Information Reliable?(差分约束)
Is the Information Reliable?DescriptionThe galaxy war between the Empire Draco and the Commonwealth of Zibu broke out 3 years ago. Draco established a line of defense called Grot. Grot is a
2014-08-22 21:00:04 524
原创 POJ-1459-Power Network(网络流 EK)
Power NetworkDescriptionA power network consists of nodes (power stations, consumers and dispatchers) connected by power transport lines. A node u may be supplied with an amount s(u) >= 0 of p
2014-08-19 08:29:22 525
原创 HDU- 3549-Flow Problem (网络流之 EK)
Flow ProblemProblem DescriptionNetwork flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow for the weighted directed graph.
2014-08-18 19:32:31 630
原创 网络流之EK 算法
白书中写道:“算法基于这样的一个事实:残量网络中任何一条从s到t的有向道路都对应一条原图中的增广路——只要求出该道路中所有残量的最小值d,把对应的所有边上的流量增加d即可,这个过程称为增广。不难验证,如果增广前的流量满足3个条件,增广后仍然满足。只要在残量网络中存在增广路,流量就可以增大;如果残量网络中不存在增广路,则当前流就是最大流。3个条件: 1.容量限制(别超过容
2014-08-18 19:27:44 863
原创 SDUT-2141-数据结构实验图论一:基于邻接矩阵的广度优先搜索遍历
数据结构实验图论一:基于邻接矩阵的广度优先搜索遍历题目描述给定一个无向连通图,顶点编号从0到n-1,用广度优先搜索(BFS)遍历,输出从某个顶点出发的遍历序列。(同一个结点的同层邻接点,节点编号小的优先遍历)输入输入第一行为整数n(0对于每组数据,第一行是三个整数k,m,t(0<k<100,0<m<(k-1)*k/2,0< t<k),表示有m条边,k个顶点,
2014-08-18 16:26:32 752
原创 HDU-2795-Billboard (线段树)
BillboardProblem DescriptionAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all poss
2014-08-17 20:57:10 485
原创 HDU-1869—六度分离 (Floyd)
六度分离Problem Description1967年,美国著名的社会学家斯坦利·米尔格兰姆提出了一个名为“小世界现象(small world phenomenon)”的著名假说,大意是说,任何2个素不相识的人中间最多只隔着6个人,即只用6个人就可以将他们联系在一起,因此他的理论也被称为“六度分离”理论(six degrees of separation)。虽然米尔格兰姆
2014-08-16 21:12:36 480
原创 POJ-3026-Borg Maze(BFS+ Prime)
Borg MazeDescriptionThe Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group conscious
2014-08-16 21:08:06 448
原创 HDU-1710-Binary Tree Traversals
#include #include #include #include using namespace std;struct node{ int data; struct node *l,*r;};// a fist b midstruct node *build (int *a,int *b,int n){ struct node *t;
2014-08-16 21:01:54 645
原创 POJ-2485-Highways (Prime)
HighwaysDescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware o
2014-08-16 20:51:11 432
原创 POJ-1611-The Suspects(并查集)
The SuspectsDescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to ot
2014-08-16 19:53:12 534
原创 The die is cast (DFS 双重)
The die is cast InterGames is a high-tech startup company that specializes in developing technology that allows users to play games over the Internet. A market analysis has alerted the
2014-08-16 19:13:48 620
原创 POJ-2536—Gopher II(二分图)
Gopher IIDescriptionThe gopher family, having averted the canine threat, must face a new predator. The are n gophers and m gopher holes, each at distinct (x, y) coordinates. A hawk arr
2014-08-16 18:41:01 663
原创 HDU-1498-50 years, 50 colors (二分图)
50 years, 50 colorsProblem DescriptionOn Octorber 21st, HDU 50-year-celebration, 50-color balloons floating around the campus, it's so nice, isn't it? To celebrate this meaningful day, the A
2014-08-16 10:46:13 507
原创 POJ-1422-Air Raid (二分图 最小路径覆盖)
Air RaidDescriptionConsider a town where all the streets are one-way and each street leads from one intersection to another. It is also known that starting from an intersection and walking thr
2014-08-15 18:34:56 493
原创 POJ-1466-Girls and Boys(二分图最大独立集)
Girls and BoysDescriptionIn the second year of the university somebody started a study on the romantic relations between the students. The relation "romantically involved" is defined between o
2014-08-15 14:30:09 636
原创 HDU-2063-过山车 (二分图)
过山车Problem DescriptionRPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只愿意和linle或LL做partner,
2014-08-15 11:06:35 595
原创 HDU-1698-Just a Hook(线段树 区间更新)
Just a HookProblem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks wh
2014-08-14 14:57:12 437
原创 HDU-1086-You can Solve a Geometry Problem too
You can Solve a Geometry Problem tooProblem DescriptionMany geometry(几何)problems were designed in the ACM/ICPC. And now, I also prepare a geometry problem for this final exam. According to
2014-08-14 10:00:49 688
原创 POJ-2031-Building a Space Station
Building a Space StationDescriptionYou are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a compu
2014-08-13 15:43:03 513
原创 POJ-3468-A Simple Problem with Integers (线段树 区间求和)
A Simple Problem with IntegersDescriptionYou have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number
2014-08-12 21:15:30 502
原创 POJ1804-Brainman(归并排序求逆序数)
BrainmanDescriptionBackground Raymond Babbitt drives his brother Charlie mad. Recently Raymond counted 246 toothpicks spilled all over the floor in an instant just by glancing at them. And h
2014-08-11 21:30:45 692
原创 POJ2299-Ultra-QuickSort (归并排序求逆序数)
Ultra-QuickSortDescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence eleme
2014-08-11 21:14:36 836
原创 POJ-2506-Tiling
TilingDescriptionIn how many ways can you tile a 2xn rectangle by 2x1 or 2x2 tiles? Here is a sample tiling of a 2x17 rectangle. InputInput is a sequence of lines, each line cont
2014-08-09 19:52:31 789
原创 HDU-1509-Windows Message Queue(优先队列)
Windows Message QueueProblem DescriptionMessage queue is the basic fundamental of windows system. For each process, the system maintains a message queue. If something happens to this process
2014-08-09 15:11:50 639
原创 HDU-1754-I Hate It
I Hate ItProblem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input本题目包含多组测试,请处理到文件结束。在
2014-08-09 10:14:00 416
原创 HDU-1166-敌兵布阵(线段树)
敌兵布阵Time Limit: 2000/1000 MS (Java/Othe/Others)Total Submission(s): 43485 Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地
2014-08-08 19:30:38 522
原创 POJ-1061-青蛙的约会(扩展欧几里得)
#include #include #include #include #define LL long longusing namespace std;LL x , y , m , n , l , a , b , c , X , Y , r , t ;LL gcd (LL a,LL b){ if ( b == 0 ) return a; retu
2014-08-07 20:50:56 650
原创 欧几里得 与 扩展欧几里得
欧几里得与扩展欧几里得欧几里德算法又称辗转相除法,用于计算两个整数a,b的最大公约数。递归的方式:int gcd (int a,int b){ if (b == 0) return a; return gcd (b, a%b);}gcd函数的基本性质:gcd(a,b)=gcd(b,a)=gcd(-a,b)
2014-08-07 20:47:15 575
原创 POJ-1006-Biorhythms(中国剩余定理)
现设 num 是下一个相同日子距离开始的天数 p,e,i,d 如题中所设!那么就可以得到三个式子:( num + d ) % 23 == p; ( num + d ) % 28 == e; ( num + d ) % 33 == i;p,e,i,d 是我们输入的,那么我们需要求出num即可,为了方便,我们将num+d暂时作为一个整体!令x = num + d
2014-08-06 14:40:52 908
原创 HDU - 1061 -Rightmost Digit (幂取模,白书)
Rightmost DigitProblem DescriptionGiven a positive integer N, you should output the most right digit of N^N. InputThe input contains several test cases. The first line of t
2014-08-06 10:35:23 497
原创 SDUT-2933-人活着系列之Streetlights (Kruskal)
人活着系列之Streetlights题目描述人活着如果是为了家庭,亲情----可以说是在这个世界上最温暖人心的,也是最让人放不下的,也是我在思索这个问题最说服自己接受的答案。对,也许活着是一种责任,为了繁殖下一代,为了孝敬父母,男人要养家糊口,女人要生儿育女,就这样循环的过下去,但最终呢?还是劳苦愁烦,转眼成空呀! 为了响应政府节约能源的政策,某市要对路灯进行改革,已知该
2014-08-05 16:39:09 688
原创 SDUT-2127- 树-堆结构练习——合并果子之哈夫曼树(STL 优先队列)
树-堆结构练习——合并果子之哈夫曼树Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%lld & %lluSubmit StatusDescription 在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆。多多决定把所有的果子合成一堆。每一次合并,多多
2014-08-04 18:29:43 688
原创 priority_queue 的简单使用方法
优先队列(priority queue)普通的队列是一种先进先出的数据结构,元素在队列尾追加,而从队列头删除。在优先队列中,元素被赋予优先级。当访问元素时,具有最高优先级的元素最先删除。优先队列具有最高进先出 (largest-in,first-out)的行为特征。
2014-08-04 17:26:17 3785
原创 POJ-1969-Count on Canton
Count on CantonDescriptionOne of the famous proofs of modern mathematics is Georg Cantor's demonstration that the set of rational numbers is enumerable. The proof works by using an explicit en
2014-08-03 21:17:55 898
原创 SDUT-2780--Pots
Pots题目描述You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i) fill the pot i (1 ≤ i ≤ 2) from the tap;DROP
2014-08-03 21:06:12 626
原创 HDU - 2066 一个人的旅行 (Dijkstra)
一个人的旅行Problem Description虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上看海芋,去纽约纯粹看雪景,去巴黎喝咖啡写信,去北京探望孟姜女…
2014-08-02 20:37:29 638
原创 HDU 1253 胜利大逃亡(BFS)
胜利大逃亡Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit Status Practice HDU 1253DescriptionIgnatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会.魔王住在一个城堡
2014-08-02 20:12:13 574
原创 SDUT 1500 Message Flood(字典树 && 模板)
Message FloodTime Limit: 1500ms Memory limit: 65536K 有疑问?点这里^_^题目描述Well, how do you feel about mobile phone? Your answer would probably be something like that "It's so conve
2014-08-02 19:50:42 557
原创 POJ-2001--Shortest Prefixes (字典树)
Shortest PrefixesDescriptionA prefix of a string is a substring starting at the beginning of the given string. The prefixes of "carbon" are: "c", "ca", "car", "carb", "carbo", and "carbon". No
2014-08-02 18:54:03 515
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人