搜索
文章平均质量分 80
唐图图
小白同学
展开
-
D. zb的生日
今天是阴历七月初五,acm队员zb的生日。zb正在和C小加、never在武汉集训。他想给这两位兄弟买点什么庆祝生日,经过调查,zb发现C小加和never都很喜欢吃西瓜,而且一吃就是一堆的那种,zb立刻下定决心买了一堆西瓜。当他准备把西瓜送给C小加和never的时候,遇到了一个难题,never和C小加不在一块住,只能把西瓜分成两堆给他们,为了对每个人都公平,他想让两堆的重量之差最小。每个西瓜的重量已原创 2016-12-13 19:16:43 · 414 阅读 · 0 评论 -
G - 诡异的楼梯 (优先队列 BFS)
Hogwarts正式开学以后,Harry发现在Hogwarts里,某些楼梯并不是静止不动的,相反,他们每隔一分钟就变动一次方向.比如下面的例子里,一开始楼梯在竖直方向,一分钟以后它移动到了水平方向,再过一分钟它又回到了竖直方向.Harry发现对他来说很难找到能使得他最快到达目的地的路线,这时Ron(Harry最好的朋友)告诉Harry正好有一个魔法道具可以帮助他寻找这样的路线,而那个魔法道原创 2017-01-16 17:42:58 · 273 阅读 · 0 评论 -
A - Kill the monster (DFS)
水题There is a mountain near yifenfei’s hometown. On the mountain lived a big monster. As a hero in hometown, yifenfei wants to kill it.Now we know yifenfei have n spells, and the monster have原创 2017-01-08 16:42:41 · 278 阅读 · 0 评论 -
F - Nightmare (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原创 2017-01-08 16:40:57 · 252 阅读 · 0 评论 -
C - Fire Net
Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall.A blockhouse is a small castl原创 2017-01-08 16:36:07 · 297 阅读 · 0 评论 -
E - Knight Moves
A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a given set of n squares on a chessboa原创 2017-01-08 16:34:07 · 339 阅读 · 0 评论 -
O - Catch That Cow
Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a pointN (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 10原创 2017-01-07 14:10:39 · 214 阅读 · 0 评论 -
J - 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原创 2017-01-07 14:09:26 · 278 阅读 · 0 评论 -
D - 胜利大逃亡
Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会. 魔王住在一个城堡里,城堡是一个A*B*C的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每分钟能从一个坐标走到相邻的六个坐标中的其中一个.现在给你城堡的地图,请你计原创 2017-01-07 14:05:51 · 252 阅读 · 0 评论 -
I - Red and Black
There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can'原创 2017-01-07 14:04:26 · 244 阅读 · 0 评论 -
B. 组合数
B. 组合数Time Limit: 3000msMemory Limit: 128000KB64-bit integer IO format: Java class name:SubmitStatusPID: 4644 找出从自然数1、2、... 、n(0<n<10)中任取r(0<r<=n)个数的所有组合。Input 输入n、r。原创 2016-12-21 19:19:48 · 264 阅读 · 0 评论 -
A - 棋盘问题
在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n 当为-1 -1时表示输入结束。原创 2016-12-23 18:42:18 · 871 阅读 · 0 评论 -
K - 迷宫问题
定义一个二维数组: 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 ×原创 2016-12-23 18:38:52 · 340 阅读 · 0 评论 -
A. 最少步数
这有一个迷宫,有0~8行和0~8列: 1,1,1,1,1,1,1,1,1 1,0,0,1,0,0,1,0,1 1,0,0,1,1,0,0,0,1 1,0,1,0,1,1,0,1,1 1,0,0,0,0,1,0,0,1 1,1,0,1,0,1,0,0,1 1,1,0,1,0,1,0,0,1 1,1,0,1,0,0,0,0,1 1,1,1,1,1,1,1,1,1原创 2016-12-12 10:42:40 · 360 阅读 · 0 评论 -
C. 部分和问题
给定整数a1、a2、.......an,判断是否可以从中选出若干数,使它们的和恰好为K。Input 首先,n和k,n表示数的个数,k表示数的和。接着一行n个数。(1<=n<=20,保证不超int范围)Output 如果和恰好可以为k,输出“YES”,并按输入顺序依次输出是由哪几个数的和组成,否则“NO”Sample Input 4 131 2原创 2016-12-15 17:00:43 · 683 阅读 · 0 评论 -
B - 下沙小面的(2) (DFS)
前文再续,书接上一题。话说当上小面的司机的Lele在施行他的那一套拉客法则以后,由于走的路线太长,油费又贵,不久便亏本了。(真可怜~)于是他又想了一个拉客的办法。对于每一次拉客活动,他一次性把乘客都拉上车(当然也不会超过7个,因为位置只有7个)。然后,Lele计算出一条路线(出于某些目的,Lele只把车上乘客的目的地作为这条路线上的站点),把所有乘客都送到目的地(在这路线上不拉上其他乘原创 2017-01-16 17:44:34 · 252 阅读 · 0 评论