自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Misdom_Tian_Ya的专栏

编程是一种美德,是促使一个人不断向上发展的一种原动力。

  • 博客(213)
  • 资源 (1)
  • 收藏
  • 关注

原创 CODE[VS] 1475 m进制转十进制

题目描述 Description将m进制数n转化成一个十进制数 m题目保证转换后的十进制数输入描述 Input Description共一行n和m输出描述 Output Description共一个数表示m进制的n化成十进制的数样例输入 Sample Input1010 2样

2017-03-21 23:41:53 459

原创 CODE[VS] 1474 十进制转m进制

题目描述 Description将十进制数n转换成m进制数 mn输入描述 Input Description共一行n和m输出描述 Output Description共一个数表示n的m进制样例输入 Sample Input样例1:10 2样例2:100 15样例输出 Sa

2017-03-21 23:12:39 540

原创 CODE[VS] 1160 蛇形矩阵

题目描述 Description小明玩一个数字游戏,取个n行n列数字矩阵(其中n为不超过100的奇数),数字的填补方法为:在矩阵中心从1开始以逆时针方向绕行,逐圈扩大,直到n行n列填满数字,请输出该n行n列正方形矩阵以及其的对角线数字之和.输入描述 Input Descriptionn(即n行n列)输出描述 Output Descriptio

2017-03-19 18:58:03 480

原创 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 the endpoin

2015-08-27 16:28:18 734

原创 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 problem. H

2015-08-26 17:02:26 351

原创 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 there is a road

2015-08-26 15:30:25 584

原创 HDU 1257 最少拦截系统 (贪心)

Problem Description某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹.怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里

2015-08-25 15:53:26 604

原创 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 from the hi

2015-08-25 15:33:42 489

原创 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 fashion. It n

2015-08-25 14:43:56 298

原创 FZU 1686 神龙的难题 (DLX重复覆盖)

Problem Description这是个剑与魔法的世界.英雄和魔物同在,动荡和安定并存.但总的来说,库尔特王国是个安宁的国家,人民安居乐业,魔物也比较少.但是.总有一些魔物不时会进入城市附近,干扰人民的生活.就要有一些人出来守护居民们不被魔物侵害.魔法使艾米莉就是这样的一个人.她骑着她的坐骑,神龙米格拉一起消灭干扰人类生存的魔物,维护王国的安定.艾米莉希望能够在损伤最小的前提下完成

2015-08-24 20:58:03 484

原创 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 operate K rada

2015-08-24 17:08:48 399

原创 HUST 1017 Exact cover (DLX模板题)

DESCRIPTIONThere is an N*M matrix with only 0s and 1s, (1 INPUTThere are multiply test cases. First line: two integers N, M; The following N lines: Every line first comes an integer C(1 OUTPUT

2015-08-24 15:45:59 340

原创 POJ 3740 Easy Finding (DLX模板)

DescriptionGiven a M×N matrix A. Aij ∈ {0, 1} (0 ≤ i InputThere are multiple cases ended by EOF. Test case up to 500.The first line of input is M, N (M ≤ 16, N ≤ 300). The next M lines every

2015-08-24 11:34:08 357

原创 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, it is

2015-08-22 20:31:12 457

转载 DLX (Dancing Links/舞蹈链)算法——求解精确覆盖问题

精确覆盖问题的定义:给定一个由0-1组成的矩阵,是否能找到一个行的集合,使得集合中每一列都恰好包含一个1例如:如下的矩阵就包含了这样一个集合(第1、4、5行) 如何利用给定的矩阵求出相应的行的集合呢?我们采用回溯法 矩阵1: 先假定选择第1行,如下所示:如上图中所示,红色的那行是选中的一行,这一行中有3个1,分别是第3、5、6列。由于这3列已经包含了

2015-08-22 18:34:10 722

原创 POJ 1088 滑雪 (记忆化搜索)

DescriptionMichael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子  1 2 3 4 516 17 18 19 615 24 25 20 714 2

2015-08-22 15:53:34 311

原创 FZU 2092 收集水晶 (DFS, 记忆化搜索)

Problem Descriptionshadow来到一片神奇的土地,这片土地上不时会出现一些有价值的水晶,shadow想要收集一些水晶带回去,但是这项任务太繁杂了,于是shadow让自己的影子脱离自己并成为一个助手来帮助自己收集这些水晶。shadow把这片土地划分成n*m个小方格,某些格子会存在一些shadow和他的影子都无法穿越的障碍,比如巨石、树木、野兽等。shadow预先探测到

2015-08-22 15:13:04 424

原创 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 ≤ moneyi ≤

2015-08-21 17:16:38 593

原创 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, straight

2015-08-21 15:56:37 381

原创 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 formula Ai+Bj

2015-08-21 12:30:24 379

原创 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 large labyrint

2015-08-21 11:28:44 343

原创 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 is lying

2015-08-20 19:45:26 382

原创 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 palindromic numb

2015-08-20 14:13:37 280

原创 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 teacher. H

2015-08-19 19:09:27 412

原创 POJ 1321 棋盘问题(DFS)

Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n

2015-08-19 14:05:24 367

原创 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 the robots i

2015-08-18 15:28:24 394

原创 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 Chinese often s

2015-08-17 15:47:36 315

原创 HDU 3791 二叉搜索树

Problem Description判断两序列是否为同一二叉搜索树序列 Input开始一个数n,(1接下去一行是一个序列,序列长度小于10,包含(0~9)的数字,没有重复数字,根据这个序列可以构造出一颗二叉搜索树。接下去的n行有n个序列,每个序列格式跟第一个序列一样,请判断这两个序列是否能组成同一颗二叉搜索树。 Output

2015-08-15 20:15:36 371

原创 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 forests with hu

2015-08-15 19:39:27 344

原创 FZU 2087 统计树边

Problem Description在图论中,树:任意两个顶点间有且只有一条路径的图。生成树:包含了图中所有顶点的一种树。最小生成树:对于连通的带权图(连通网)G,其生成树也是带权的。生成树T各边的权值总和称为该树的权,权最小的生成树称为G的最小生成树(Minimum Spanning Tree)。最小生成树可简记为MST。但是,对于一个图而言,最小生成树并不是唯一的。现

2015-08-15 16:55:59 400

原创 POJ 3687 Labeling Balls (逆向建边)

DescriptionWindy 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 two balls share the same label.The labeling satisfies seve

2015-08-15 15:45:16 357

原创 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 sorted sequenc

2015-08-14 11:25:55 406

原创 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 sequence.Plea

2015-08-13 10:52:20 355

原创 HDU 4991 Ordered Subsequence

Problem DescriptionA numeric sequence of ai is ordered if a12N. Let the subsequence of the given numeric sequence (a1, a2,……, aN) be any sequence (ai1, ai2,……, aiK), where 112 KYour program,

2015-08-11 15:47:06 368

原创 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 collection of s

2015-08-09 15:21:21 355

原创 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 matching the

2015-08-08 16:22:33 513

原创 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。 此人对N个动物

2015-08-07 19:07:24 335

原创 HDU 1272 小希的迷宫

Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路

2015-08-06 09:47:15 266

原创 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/2,…

2015-08-05 18:28:36 908

原创 HDU 2187 悼念512汶川大地震遇难同胞——老人是真饿了(贪心)

Problem Description时间:2008年5月16日(震后第4天)地点:汶川县牛脑寨人物:羌族老奶奶【转载整理】牛脑寨是一个全村600多人的羌族寨子,震后几天,这里依然能常常听到隆隆的声音,那是对面山上石头不断滑落的声音。在完成整个突击队的抢修移动基站的任务后,我提着相机开始记录这里的受创情况。突然,我的视线里出现一个羌族老人,这让我无比的震惊,要知道,那是

2015-06-14 00:48:20 542

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除