- 博客(211)
- 收藏
- 关注
转载 CODE[VS] 1160 蛇形矩阵
题目描述Description小明玩一个数字游戏,取个n行n列数字矩阵(其中n为不超过100的奇数),数字的填补方法为:在矩阵中心从1开始以逆时针方向绕行,逐圈扩大,直到n行n列填满数字,请输出该n行n列正方形矩阵以及其的对角线数字之和.输入描述Input Descriptionn(即n行n列)输出描述Outp...
2017-03-19 18:58:00
169
转载 POJ 2513 Colored Sticks (Trie树,欧拉通路,并查集)
DescriptionYou are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possible to align the sticks in a straight line such that the colors of th...
2015-08-27 16:28:00
197
转载 HDU 1054 Strategic Game (最小顶点覆盖)
Problem DescriptionBob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enough and then he is very sad. Now he has the following...
2015-08-26 17:02:00
148
转载 HDU 3861 The King’s Problem (强连通分量缩点+二分图匹配最小路径覆盖)
Problem DescriptionIn the Kingdom of Silence, the king has a new problem. There are N cities in the kingdom and there are M directional roads between the cities. That means that if ther...
2015-08-26 15:30:00
156
转载 HDU 1257 最少拦截系统 (贪心)
Problem Description某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹.怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大...
2015-08-25 15:53:00
126
转载 POJ 3485 Highway (贪心, 区间选点)
DescriptionBob is a skilled engineer. He must design a highway that crosses a region with few villages. Since this region is quite unpopulated, he wants to minimize the number of exits fr...
2015-08-25 15:33:00
149
转载 HDU 1051 Wooden Sticks (贪心)
Problem DescriptionThere is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one fa...
2015-08-25 14:43:00
82
转载 FZU 1686 神龙的难题 (DLX重复覆盖)
Problem Description这是个剑与魔法的世界.英雄和魔物同在,动荡和安定并存.但总的来说,库尔特王国是个安宁的国家,人民安居乐业,魔物也比较少.但是.总有一些魔物不时会进入城市附近,干扰人民的生活.就要有一些人出来守护居民们不被魔物侵害.魔法使艾米莉就是这样的一个人.她骑着她的坐骑,神龙米格拉一起消灭干扰人类生存的魔物,维护王国的安定.艾米莉希望能够在...
2015-08-24 20:58:00
133
转载 HDU 2295 Radar (二分+DLX,重复覆盖)
Problem DescriptionN cities of the Java Kingdom need to be covered by radars for being in a state of war. Since the kingdom has M radar stations but only K operators, we can at most ope...
2015-08-24 17:08:00
244
转载 HUST 1017 Exact cover (DLX模板题)
DESCRIPTIONThere is an N*M matrix with only 0s and 1s, (1 <= N,M <= 1000). An exact cover is a selection of rows such that every column has a 1 in exactly one of the selected rows. ...
2015-08-24 15:45:00
103
转载 POJ 3740 Easy Finding (DLX模板)
DescriptionGiven aM×NmatrixA.Aij∈ {0, 1} (0 ≤ i < M, 0 ≤ j < N), could you find some rows that let every cloumn contains and only contains one 1.InputThere are multiple c...
2015-08-24 11:34:00
101
转载 ZOJ 3209 Treasure Map (DLX精确覆盖)
Your boss once had got many copies of a treasure map. Unfortunately, all the copies are now broken to many rectangular pieces, and what make it worse, he has lost some of the pieces. Luckily,...
2015-08-22 20:31:00
142
转载 DLX (Dancing Links/舞蹈链)算法——求解精确覆盖问题
精确覆盖问题的定义:给定一个由0-1组成的矩阵,是否能找到一个行的集合,使得集合中每一列都恰好包含一个1例如:如下的矩阵就包含了这样一个集合(第1、4、5行)如何利用给定的矩阵求出相应的行的集合呢?我们采用回溯法矩阵1:先假定选择第1行,如下所示:如上图中所示,红色的那行是选中的一行,这一行中有3个1,分别是第3、5、6列。由...
2015-08-22 18:34:00
103
转载 POJ 1088 滑雪 (记忆化搜索)
DescriptionMichael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 516 17 18 19 615 24 25 2...
2015-08-22 15:53:00
85
转载 FZU 2092 收集水晶 (DFS, 记忆化搜索)
Problem Descriptionshadow来到一片神奇的土地,这片土地上不时会出现一些有价值的水晶,shadow想要收集一些水晶带回去,但是这项任务太繁杂了,于是shadow让自己的影子脱离自己并成为一个助手来帮助自己收集这些水晶。shadow把这片土地划分成n*m个小方格,某些格子会存在一些shadow和他的影子都无法穿越的障碍,比如巨石、树木、野兽等。sh...
2015-08-22 15:13:00
88
转载 POJ 3273 Monthly Expense (二分,最小化最大值)
DescriptionFarmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of money (1 ≤...
2015-08-21 17:16:00
111
转载 POJ 3258 River Hopscotch (二分,最大化最小值)
DescriptionEvery year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The excitement takes place on a long, ...
2015-08-21 15:56:00
119
转载 HDU 2141 Can you find it? (二分查找)
Problem DescriptionGive you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the ...
2015-08-21 12:30:00
117
转载 HDU 1026 Ignatius and the Princess I (BFS)
Problem DescriptionThe Princess has been abducted by the BEelzebub feng5166, our hero Ignatius has to rescue our pretty Princess. Now he gets into feng5166's castle. The castle is a lar...
2015-08-21 11:28:00
89
转载 POJ 1753 Flip Game (BFS)
DescriptionFlip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one is black and each piece...
2015-08-20 19:45:00
123
转载 ZOJ 3816 Generalized Palindromic Number (DFS,暴力枚举)
A number that will be the same when it is written forwards or backwards is known as a palindromic number. For example, 1234321 is a palindromic number.We call a number generalized palindrom...
2015-08-20 14:13:00
126
转载 HDU 4403 A very hard Aoshu problem (DFS)
Problem DescriptionAoshu is very popular among primary school students. It is mathematics, but much harder than ordinary mathematics for primary school students. Teacher Liu is an Aoshu...
2015-08-19 19:09:00
120
转载 POJ 1321 棋盘问题(DFS)
Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋...
2015-08-19 14:05:00
87
转载 HDU 4305 Lightning (判断点在线段上,生成树计数)
Problem DescriptionThere are N robots standing on the ground (Don't know why. Don't know how).Suddenly the sky turns into gray, and lightning storm comes! Unfortunately, one of t...
2015-08-18 15:28:00
122
转载 HDU 5137 How Many Maos Does the Guanxi Worth (最短路径最大值)
Problem Description"Guanxi" is a very important word in Chinese. It kind of means "relationship" or "contact". Guanxi can be based on friendship, but also can be built on money. So Chin...
2015-08-17 15:47:00
136
转载 HDU 3791 二叉搜索树
Problem Description判断两序列是否为同一二叉搜索树序列Input开始一个数n,(1<=n<=20) 表示有n个需要判断,n= 0 的时候输入结束。接下去一行是一个序列,序列长度小于10,包含(0~9)的数字,没有重复数字,根据这个序列可以构造出一颗二叉搜索树。接下去的n行有n个序列,每个序列格式跟第一...
2015-08-15 20:15:00
72
转载 POJ 2418 Hardwood Species (trie树\map)
DescriptionHardwoods are the botanical group of trees that have broad leaves, produce a fruit or nut, and generally go dormant in the winter.America's temperate climates produce forest...
2015-08-15 19:39:00
124
转载 FZU 2087 统计树边
Problem Description在图论中,树:任意两个顶点间有且只有一条路径的图。生成树:包含了图中所有顶点的一种树。最小生成树:对于连通的带权图(连通网)G,其生成树也是带权的。生成树T各边的权值总和称为该树的权,权最小的生成树称为G的最小生成树(Minimum Spanning Tree)。最小生成树可简记为MST。但是,对于一个图而言,最小生成树并...
2015-08-15 16:55:00
80
转载 POJ 3687 Labeling Balls (逆向建边)
DescriptionWindy hasNballs of distinct weights from 1 unit toNunits. Now he tries to label them with 1 toNin such a way that:No two balls share the same label.The labeling satis...
2015-08-15 15:45:00
98
转载 POJ 1094 Sorting It All Out (拓扑排序)
DescriptionAn ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorte...
2015-08-14 11:25:00
82
转载 hdu 5147 Sequence II(前缀和,后缀和)
Problem DescriptionLong long ago, there is a sequence A with length n. All numbers in this sequence is no smaller than 1 and no bigger than n, and all numbers are different in this sequ...
2015-08-13 10:52:00
109
转载 HDU 4991 Ordered Subsequence
Problem DescriptionA numeric sequence of aiis ordered if a1<a2<……<aN. Let the subsequence of the given numeric sequence (a1, a2,……, aN) be any sequence (ai1, ai2,……, aiK), w...
2015-08-11 15:47:00
117
转载 POJ 3349 Snowflake Snow Snowflakes (链式解决冲突)
DescriptionYou may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your program will read information about a collec...
2015-08-09 15:21:00
145
转载 HDU 2473 Junk-Mail Filter(删点)
Problem DescriptionRecognizing junk mails is a tough task. The method used here consists of two steps:1) Extract the common characteristics from the incoming email.2) Use a filter m...
2015-08-08 16:22:00
123
转载 POJ 1182 食物链
Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这N个动物所构成的食物链关系进行描述:第一种说法是"1 X Y",表示X和Y是同类。第二种说法是"2 X Y",表示X吃Y。...
2015-08-07 19:07:00
88
转载 HDU 1272 小希的迷宫
Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路...
2015-08-06 09:47:00
76
转载 Code[vs] 1083 Cantor表
题目描述Description现代数学的著名证明之一是Georg Cantor证明了有理数是可枚举的。他是用下面这一张表来证明这一命题的: 1/1 1/2 1/3 1/4 1/5 … 2/1 2/2 2/3 2/4 … 3/1 3/2 3/3 … 4/1 4/2 … 5/1 … … 我们以Z字形给上表的每一项编号。第一项是1/1,然后是1/2,2/1,3/1,2...
2015-08-05 18:28:00
458
转载 HDU 2187 悼念512汶川大地震遇难同胞——老人是真饿了(贪心)
Problem Description时间:2008年5月16日(震后第4天)地点:汶川县牛脑寨人物:羌族老奶奶【转载整理】牛脑寨是一个全村600多人的羌族寨子,震后几天,这里依然能常常听到隆隆的声音,那是对面山上石头不断滑落的声音。在完成整个突击队的抢修移动基站的任务后,我提着相机开始记录这里的受创情况。突然,我的视线里出现一个羌族老人,这让我无...
2015-06-14 00:48:00
104
转载 HDU 2570 迷瘴 (贪心)
Problem Description通过悬崖的yifenfei,又面临着幽谷的考验——幽谷周围瘴气弥漫,静的可怕,隐约可见地上堆满了骷髅。由于此处长年不见天日,导致空气中布满了毒素,一旦吸入体内,便会全身溃烂而死。幸好yifenfei早有防备,提前备好了解药材料(各种浓度的万能药水)。现在只需按照配置成不同比例的浓度。现已知yifenfei随身携带有n种...
2015-06-14 00:19:00
103
转载 HDU 1232 畅通工程(并查集)
Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整...
2015-05-11 21:23:00
83
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人