自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(57)
  • 收藏
  • 关注

原创 诡异的楼梯 BFS

Hogwarts正式开学以后,Harry发现在Hogwarts里,某些楼梯并不是静止不动的,相反,他们每隔一分钟就变动一次方向.比如下面的例子里,一开始楼梯在竖直方向,一分钟以后它移动到了水平方向,再过一分钟它又回到了竖直方向.Harry发现对他来说很难找到能使得他最快到达目的地的路线,这时Ron(Harry最好的朋友)告诉Harry正好有一个魔法道具可以帮助他寻找这样的路线,而那个魔法道具上的...

2019-04-29 21:11:57 165

原创 Sticks DFS+剪枝

George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had orig...

2019-04-28 21:07:18 157

原创 胜利大逃亡 三维BFS

Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会.魔王住在一个城堡里,城堡是一个ABC的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每分钟能从一个坐标走到相邻的六个坐标中的其中一个.现在给你城堡的地图,请你计算出Igna...

2019-04-28 19:22:33 123

原创 Find a way BFS

Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki.Yifenfei’s home is at the cou...

2019-04-28 18:57:00 139

原创 Evolution Game DP

题目描述In the fantasy world of ICPC there are magical beasts. As they grow, these beasts can change form, and every time they do they become more powerful. A beast cannot change form completely arbitrar...

2019-04-28 15:32:00 128

原创 Singing Everywhere 模拟

Sample Input361 1 4 5 1 471 9 1 9 8 1 0102 1 4 7 4 8 3 6 4 7Sample Output102HintFor the first sample test case, BaoBao does not need to delete a note. Because if he deletes no note, he w...

2019-04-27 20:15:49 345

原创 Fibonacci in the Pocket 模拟

Sample Input61 21 31 41 5123456 12345678987654321123 20190427201904272019042720190427Sample Output001001题目意思是说,求给出的范围内,所有斐波纳契数列项的和,即从斐波纳契数列的第X项求和求到第Y项,问这个结果是单数还是偶数。其实并不难,首先写一下斐波纳契数列的前...

2019-04-27 20:07:23 215

原创 Dungeon Master 三维广搜

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-04-26 19:36:51 111

原创 FatMouse and Cheese DFS+DP

FatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n: each grid location is labelled (p,q) where 0 <= p < n and 0 <= q < n. At each grid lo...

2019-04-26 17:10:50 110

原创 Mahjong Sorting 模拟

DreamGrid has just found a set of Mahjong with 3M suited tiles and a White Dragon tile in his pocket. Each suited tile has a suit (Character, Bamboo or Dot) and a rank (ranging from 1 to M), and ther...

2019-04-25 21:25:51 262

原创 最少拦截系统 DP

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

2019-04-23 21:01:22 278

原创 Friends 模拟+大数乘法

Mike has many friends. Here are nine of them: Alice, Bob, Carol, Dave, Eve, Frank, Gloria, Henry and Irene.Mike is so skillful that he can master n languages (aka. programming languages).His nine fr...

2019-04-23 20:09:22 89

原创 免费馅饼 DP

都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个身手敏捷的高手,但在现实中运动神经特别迟钝...

2019-04-22 21:32:46 291

原创 Tunnels 状压DP+BFS

Bob is travelling in Xi’an. He finds many secret tunnels beneath the city. In his eyes, the city is a grid. He can’t enter a grid with a barrier. In one minute, he can move into an adjacent grid with ...

2019-04-22 19:52:54 198

原创 Super Jumping! Jumping! Jumping! 最长上升子序列+DP

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 ...

2019-04-22 19:39:57 180

原创 What day is that day? 模拟

It’s Saturday today, what day is it after 11 + 22 + 33 + … + NN days?InputThere are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each t...

2019-04-22 16:22:42 270

原创 Dividing 多重背包 DP

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-04-21 17:02:04 219

原创 ACboy needs your help 分组背包DP

ACboy has N courses this term, and he plans to spend at most M days on study.Of course,the profit he will gain from different course depending on the days he spend on it.How to arrange the M days for ...

2019-04-21 15:46:23 119

原创 饭卡 01背包 DP

电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。Input多组数据。对于每组数据:第一行为正整数n,表示菜的...

2019-04-21 14:42:56 163

原创 Longest Ordered Subsequence 最长上升子序列+DP

A numeric sequence of ai is ordered if a1 < a2 < … < aN. Let the subsequence of the given numeric sequence ( a1, a2, …, aN) be any sequence ( ai1, ai2, …, aiK), where 1 <= i1 < i2 < ...

2019-04-20 21:36:28 93

原创 完全背包问题+01背包问题+分组背包+多重背包 总结

背包问题都涉及到动态规划,利用dp进行更加优化的计算。最基本的是01背包问题,题目一般类似:“在一定数目物品内,挑选总重量不超过一定数目的物品,其中每个物品只能选一次,求背包内物品价值的最大值或者最小值”,从名字就可以看出,要么选0个,要么选1个。如果按照暴力的方法,时间复杂度会爆表,这里采用的是记忆化搜索的方式,加以DP。首先,选一个二维数组dp,这个数组的含义是从前i个物品中选出总重量不...

2019-04-20 20:57:35 2735 2

原创 Piggy-Bank 完全背包问题

Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM). The idea behind is simple...

2019-04-20 19:08:46 218

原创 Clumsy Keke 三维数组模拟

Problem DescriptionKeke is currently studying engineering drawing courses, and the teacher has taught her how to find its volume through the three views of the part. But her brain doesn’t work well t...

2019-04-19 21:28:43 198

原创 Coding Problem 模拟

Problem DescriptionHere is the logic.I am the brother of mata Chuang.Mata chuang is the brother of cxk.So what am I?Am I the grand-brother of cxk?Or am I in a position that same brother level of cxk?...

2019-04-19 21:23:44 186

原创 Wow! Such City! 最短路问题

Doge, tired of being a popular image on internet, is considering moving to another city for a new way of life.In his country there are N (2 ≤N≤ 1000) cities labeled 0 . . . N - 1. He is currently in ...

2019-04-18 21:46:12 167

原创 命运 DP

穿过幽谷意味着离大魔王lemon已经无限接近了!可谁能想到,yifenfei在斩杀了一些虾兵蟹将后,却再次面临命运大迷宫的考验,这是魔王lemon设下的又一个机关。要知道,不论何人,若在迷宫中被困1小时以上,则必死无疑!可怜的yifenfei为了去救MM,义无返顾地跳进了迷宫。让我们一起帮帮执着的他吧!命运大迷宫可以看成是一个两维的方格阵列,如下图所示:yifenfei一开始在左上角,目...

2019-04-17 21:54:26 271

原创 The Triangle DP模板题

73 88 1 02 7 4 44 5 2 6 5(Figure 1)Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the top and e...

2019-04-17 19:49:04 145

原创 May Day Holiday 日期模拟

As a university advocating self-learning and work-rest balance, Marjar University has so many days of rest, including holidays and weekends. Each weekend, which consists of Saturday and Sunday, is a r...

2019-04-16 22:02:49 894

原创 Team Formation 思维题

For an upcoming programming contest, Edward, the headmaster of Marjar University, is forming a two-man team from N students of his university.Edward knows the skill level of each student. He has foun...

2019-04-16 21:34:09 198

原创 Beauty of Array 动态规划

Edward has an array A with N integers. He defines the beauty of an array as the summation of all distinct integers in the array. Now Edward wants to know the summation of the beauty of all contiguous ...

2019-04-16 21:13:22 136

原创 Extended Twin Composite Number 思维题

Do you know the twin prime conjecture? Two primes a and b are called twin primes if a+2=b. The twin prime conjecture is an unsolved problem in mathematics, which asks for a proof or a disproof for the...

2019-04-15 21:25:51 251

原创 Postman 模拟

N letters have just arrived at the post office positioned at x=0, and the i -th letter should be posted to position x=ai . BaoBao, our beloved postman, will start his work from the post office and del...

2019-04-15 19:45:17 318

原创 Thanks, TuSimple! STL+贪心

In the very first sentence of the very first problem, we would like to give our sincere thanks to TuSimple, the sponsor of this contest.Founded in 2015, TuSimple is a global autonomous trucking solut...

2019-04-15 19:29:47 357

原创 时间间隔 复杂模拟

Problem Description2019年1月1日,在云栖出现了可能是全世界最长的以秒为单位的倒计时装置:九亿多秒倒计时,直到2050年。给出一个时间S,我们想知道S距离2050年1月1日0点0时0分多少秒。因为答案可能很大,请输出答案模100的值。Input第一行一个正整数 T (1≤T≤100000) 表示数据组数。对于每组数据,一行一个字符串表示时间。时间格式为:YYYY...

2019-04-13 21:17:50 225

原创 Progressive Scramble 复杂模拟

题目描述You are a member of a naive spy agency. For secure communication,members of the agency use a very simple encryption algorithm – which changes each symbol in the message ‘progressively’, i.e., bas...

2019-04-12 21:24:31 218

原创 Greeting Card 模拟

样例输入420180000 2018000020180000 2018201820182018 2018000020182018 20182018样例输出4首先题意是说给你一些点,让你在里面任选两个,统计所有可能中两个点距离为2018的对数。一开始思路是暴力,但是想想肯定会超时,这里方法比较像广搜中dir数组的用法,提前暴力计算一下如果两点距离为2018那么这两个点坐标之间的关系...

2019-04-12 21:12:29 360 3

原创 Defuse the Bomb 模拟

The bomb is about to explode! Please defuse it as soon as possible!There is a display showing a number from 1 to 4 on the bomb. Besides this, there are 4 buttons under the display. Each button is lab...

2019-04-11 21:34:44 611

原创 People Counting STL+模拟

In a BG (dinner gathering) for ZJU ICPC team, the coaches wanted to count the number of people present at the BG. They did that by having the waitress take a photo for them. Everyone was in the photo ...

2019-04-11 21:15:54 176

原创 Ground Defense 模拟

题目描述You are a denizen of Linetopia, whose n major cities happen to be equally spaced along an east-west line. In fact, they are often numbered in order from 1 to n, where 1 is the westmost city and n...

2019-04-10 22:06:05 172

原创 Congestion Charging Zone 水题

题目描述Tehran municipality has set up a new charging method for the Congestion Charging Zone (CCZ) which controls the passage of vehicles in Tehran’s high-congestion areas in the congestion period (CP) ...

2019-04-10 19:43:18 227

空空如也

空空如也

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

TA关注的人

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