
寒假训练题
Z~柳
这个作者很懒,什么都没留下…
展开
-
UVA10020(贪心--最小覆盖问题)
Given several segments of line (int the X axis) with coordinates [Li, Ri]. You are to choose the minimalamount of them, such they would completely cover the segment [0, M].InputThe first line is ...原创 2019-02-21 13:12:10 · 255 阅读 · 0 评论 -
模拟搜索(poj3087)
A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker chips, S1 and S2, each stack containing C chips. Ea...原创 2019-01-31 00:11:41 · 240 阅读 · 0 评论 -
hdu1102(最小生成树)
There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are connected, if and only if t...原创 2019-01-28 21:07:17 · 259 阅读 · 0 评论 -
poj3126怪癖首相(广搜)
The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.— It is a matter of sec...原创 2019-01-30 21:01:07 · 154 阅读 · 0 评论 -
poj1426(dfs)
Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there...原创 2019-02-10 10:50:09 · 282 阅读 · 0 评论 -
hdu2571(棋盘翻转)
穿过幽谷意味着离大魔王lemon已经无限接近了!可谁能想到,yifenfei在斩杀了一些虾兵蟹将后,却再次面临命运大迷宫的考验,这是魔王lemon设下的又一个机关。要知道,不论何人,若在迷宫中被困1小时以上,则必死无疑!可怜的yifenfei为了去救MM,义无返顾地跳进了迷宫。让我们一起帮帮执着的他吧!命运大迷宫可以看成是一个两维的方格阵列,如下图所示:yifenfei一开始在左上角,目的...原创 2019-02-10 00:03:01 · 177 阅读 · 0 评论 -
hdu1072走出迷宫(bfs)
Ignatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb explodes. The initial ...原创 2019-02-16 00:25:58 · 273 阅读 · 0 评论 -
hdu1075火星文翻译(map,字典树)
Ignatius is so lucky that he met a Martian yesterday. But he didn’t know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. Now Ignatius want ...原创 2019-02-15 20:08:20 · 434 阅读 · 0 评论 -
取模运算加快速幂法(hdu1420)
集训进行了将近2个礼拜,这段时间以恢复性训练为主,我一直在密切关注大家的训练情况,目前为止,对大家的表现相当满意,首先是绝大部分队员的训练积极性很高,其次,都很遵守集训纪律,最后,老队员也起到了很好的带头作用,这里特别感谢为这次DP专题练习赛提供题目和测试数据的集训队队长xhd同学.特别高兴的是,跟随集训队训练的一批新队员表现非常好,进步也比较显著,特别是训练态度大大超出我的预期,我敢说,如果各...原创 2019-01-30 01:38:10 · 155 阅读 · 0 评论 -
最大上升序列(hdu1087)
Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now.The game can b...原创 2019-01-30 01:27:49 · 172 阅读 · 0 评论 -
hdu1006(最大连续子序列)
Given a sequence a[1],a[2],a[3]…a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14.InputThe first l...原创 2019-01-30 01:06:03 · 205 阅读 · 0 评论 -
poj3279(反转问题)
Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an M × N grid (1 ≤ M ≤ 15; 1 ≤ N ≤ 15...原创 2019-02-22 16:26:19 · 231 阅读 · 0 评论 -
hdu3533红蓝大战(广搜)
The students of the HEU are maneuvering for their military training.The red army and the blue army are at war today. The blue army finds that Little A is the spy of the red army, so Little A has to e...原创 2019-02-11 21:16:35 · 173 阅读 · 0 评论 -
poj1797(最短路,Dijkstra算法)
题目:BackgroundHugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the place his ...原创 2019-02-21 11:57:55 · 219 阅读 · 0 评论 -
hdu1069 测猴子智力(改成最大上升子序列)
A group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the monkey with some blocks. If the monk...原创 2019-02-21 11:32:22 · 153 阅读 · 0 评论 -
CodeForces - 510A(水题)
Fox Ciel starts to learn programming. The first task is drawing a fox! However, that turns out to be too hard for a beginner, so she decides to draw a snake instead.A snake is a pattern on a n by m t...原创 2019-02-14 15:12:40 · 176 阅读 · 0 评论 -
hdu1166敌兵布阵(线段树求区间和详解)
C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什么战术,所以...原创 2019-02-14 14:19:35 · 173 阅读 · 0 评论 -
hdu2380(dp,最大矩形面积)
Given an N * M matrix with each entry equal to 0 or 1. We can find some rectangles in the matrix whose entries are all 1, and we define the maximum area of such rectangle as this matrix’s goodness.We...原创 2019-02-24 12:53:26 · 243 阅读 · 0 评论 -
UVA410(贪心)
The International Space Station contains many centrifuges in its labs. Each centrifuge will have somenumber © of chambers each of which can contain 0, 1, or 2 specimens. You are to write a programwh...原创 2019-02-24 10:18:45 · 240 阅读 · 0 评论 -
UVA11264 钱币兑换(dp+贪心+详解)
Our dear Sultan is visiting a country where there are n different types of coin. He wants to collectas many different types of coin as you can. Now if he wants to withdraw X amount of money from aBa...原创 2019-02-13 12:10:44 · 317 阅读 · 0 评论 -
hdu1016素数环(dfs)
A ring is compose of n circles as shown in diagram. Put natural number 1, 2, …, n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.Note: the number of fir...原创 2019-02-13 00:07:03 · 150 阅读 · 0 评论 -
HDU1010(奇偶剪枝+dfs)
The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone ...原创 2019-02-12 17:26:34 · 166 阅读 · 0 评论 -
hdu1495 平分可乐(bfs)
大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S<101)毫升 (正好装满一瓶) ,它们三个之间可以相互倒可乐 (都是没有刻度的,且 S==N+M,101>S>...原创 2019-02-12 11:24:36 · 340 阅读 · 0 评论 -
最大连续子序列(hdu1231)
给定K个整数的序列{ N1, N2, …, NK },其任意连续子序列可表示为{ Ni, Ni+1, …,Nj },其中 1 <= i <= j <= K。最大连续子序列是所有连续子序列中元素和最大的一个,例如给定序列{ -2, 11, -4, 13, -5, -2 },其最大连续子序列为{ 11, -4, 13 },最大和为20。在今年的数据结构考卷中,要求编写程序得到...原创 2019-01-30 00:58:23 · 116 阅读 · 0 评论 -
hdu2068PRG错排(结合组合数)
今年暑假杭电ACM集训队第一次组成女生队,其中有一队叫RPG,但做为集训队成员之一的野骆驼竟然不知道RPG三个人具体是谁谁。RPG给他机会让他猜猜,第一次猜:R是公主,P是草儿,G是月野兔;第二次猜:R是草儿,P是月野兔,G是公主;第三次猜:R是草儿,P是公主,G是月野兔;…可怜的野骆驼第六次终于把RPG分清楚了。由于RPG的带动,做ACM的女生越来越多,我们的野骆驼想都知道她们,可现在有N多人,...原创 2019-01-30 00:25:30 · 135 阅读 · 0 评论 -
hdu 1754询问成绩(线段树求区间最大值)
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0<N<=200000,0<M<5000 )...原创 2019-02-14 17:34:03 · 287 阅读 · 0 评论 -
寒假训练题之dfs(hdu1241)
The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides th...原创 2019-01-28 23:18:14 · 161 阅读 · 0 评论 -
寒假训练题之高精度算法(uva424)
One of the first users of BIT’s new supercomputer was Chip Diller. He extended his exploration ofpowers of 3 to go from 0 to 333 and he explored taking various sums of those numbers.“This supercompu...原创 2019-01-28 23:11:23 · 153 阅读 · 0 评论 -
acm新手训练之卡特兰数(hdu2067)
小兔的叔叔从外面旅游回来给她带来了一个礼物,小兔高兴地跑回自己的房间,拆开一看是一个棋盘,小兔有所失望。不过没过几天发现了棋盘的好玩之处。从起点(0,0)走到终点(n,n)的最短路径数是C(2n,n),现在小兔又想如果不穿越对角线(但可接触对角线上的格点),这样的路径数有多少?小兔想了很长时间都没想出来,现在想请你帮助小兔解决这个问题,对于你来说应该不难吧!Input每次输入一个数n(1&lt...原创 2019-01-23 23:05:19 · 467 阅读 · 0 评论 -
新手训练题之错排公式(hdu2049)
国庆期间,省城HZ刚刚举行了一场盛大的集体婚礼,为了使婚礼进行的丰富一些,司仪临时想出了有一个有意思的节目,叫做"考新郎",具体的操作是这样的:首先,给每位新娘打扮得几乎一模一样,并盖上大大的红盖头随机坐成一排;然后,让各位新郎寻找自己的新娘.每人只准找一个,并且不允许多人找一个.最后,揭开盖头,如果找错了对象就要当众跪搓衣板…看来做新郎也不是容易的事情…假设一共有N对新婚夫妇,其中有M...原创 2019-01-23 23:15:49 · 182 阅读 · 0 评论 -
最小生成树之城市规划
问题描述:You are assigned to design network connections between certain points in a wide area. You are given a set of points in the area, and a set of possible routes for the cables that may connect pair...原创 2019-01-27 10:10:30 · 590 阅读 · 0 评论 -
新手训练题之HDU1213(并查集)
问题描述:Today is Ignatius’ birthday. He invites a lot of friends. Now it’s dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each ot...原创 2019-01-27 10:15:36 · 170 阅读 · 0 评论 -
hdu1442(世界杯)
世界杯结束了,意大利人连本带利的收回了法国人6年前欠他们的债,捧起了大力神杯,成就了4星意大利.世界杯虽然结束了,但是这界世界杯给我们还是留下许多值得回忆的东西.比如我们听到了黄名嘴的3分钟激情解说,我们懂得了原来可以向同一个人出示3张黄牌,我们还看到了齐达内的头不仅能顶球还能顶人…………介于有这么多的精彩,xhd决定重温德国世界杯,当然只是去各个承办世界杯比赛的城市走走看看.但是这需要一大比...原创 2019-01-28 20:57:27 · 146 阅读 · 0 评论 -
HDU2251 3Ddungeon(bfs)
You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south...原创 2019-02-03 16:47:53 · 244 阅读 · 0 评论 -
POJ1321棋盘问题(dfs)
在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n当为...原创 2019-02-02 15:01:44 · 108 阅读 · 0 评论 -
CodeForces - 268B(数学)
Manao is trying to open a rather challenging lock. The lock has n buttons on it and to open it, you should press the buttons in a certain order to open the lock. When you push some button, it either s...原创 2019-02-14 18:29:03 · 324 阅读 · 0 评论 -
uva11389公车早晚班(贪心详解)
In a city there are n bus drivers. Also there are n morning bus routes and n afternoon bus routes withvarious lengths. Each driver is assigned one morning route and one evening route. For any driver,...原创 2019-02-14 20:42:35 · 578 阅读 · 0 评论 -
寒假训练题之取模的除法运算
要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。Input数据的第一行是一个T,表示有T组数据。每组数据有两个数n(0 <= n < 9973)和B(1 <= B <= 10^9)。Output对应每组数据输出(A/B)%9973。Sample Input21000 53...原创 2019-01-30 00:10:51 · 260 阅读 · 0 评论 -
寒假训练题之bfs(poj3984)
定义一个二维数组:int maze[5][5] = {0, 1, 0, 0, 0,0, 1, 0, 1, 0,0, 0, 0, 0, 0,0, 1, 1, 1, 0,0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。Input一个5 × 5的二维数组,表示一个迷...原创 2019-01-30 00:00:19 · 126 阅读 · 0 评论 -
poj1014(多重背包问题)
Marsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the marbles. This would be easy if all the marbles had the same v...原创 2019-01-29 23:35:39 · 394 阅读 · 0 评论