BFS
jiang_16
一个想学好编程的弱渣妹纸,猎奇,脑洞向...
展开
-
团战可以输、提莫必须死
为了一些你们不知道的原因,我们把LOL的地图抽象为一个n×m的矩阵 提莫积攒了k个蘑菇准备种到地图上去,因为提莫的背篓漏了,所以每一个提莫走过的地方都会被摆下一个蘑菇,两个蘑菇同时种在一个地方的话就会爆炸,所以一旦即将出现这种情况,提莫会直接传送回家,防止自己被炸死 之前的排位赛中因为乱种蘑菇提莫已经被骂了好多次了,所以这次提莫特地查资料对当前地图的各个位置种下原创 2017-08-07 09:46:16 · 379 阅读 · 0 评论 -
695. Max Area of Island
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrou原创 2017-11-14 11:26:07 · 122 阅读 · 0 评论 -
汤圆の拯救计划
QAQ蒟蒻每一次都可以移动到相邻的非墙的格子中,每次移动都要花费1个单位的时间有公共边的格子定义为相邻Input一开始为一个整数T代表一共有T组数据每组测试数据的第一行有两个整数n,m (2接下来的n行m列为大魔王的迷宫,其中’#’为墙壁,‘_‘为地面A代表QAQ蒟蒻,O代表汤圆公主:Output一组数据输出一个整数代表从QAQ蒟原创 2017-07-24 16:30:30 · 289 阅读 · 0 评论 -
第八届ACM校赛->魔戒
Problem Description蓝色空间号和万有引力号进入了四维水洼,发现了四维物体--魔戒。这里我们把飞船和魔戒都抽象为四维空间中的一个点,分别标为 "S" 和 "E"。空间中可能存在障碍物,标为 "#",其他为可以通过的位置。现在他们想要尽快到达魔戒进行探索,你能帮他们算出最小时间是最少吗?我们认为飞船每秒只能沿某个坐标轴方向移动一个单位,且不能越出四维空间。原创 2017-07-26 08:57:04 · 241 阅读 · 0 评论 -
迷宫问题 POJ
定义一个二维数组: 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表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。原创 2017-08-01 16:56:52 · 169 阅读 · 0 评论 -
Find The Multiple POJ
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原创 2017-07-31 21:54:28 · 181 阅读 · 0 评论 -
Find a way
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 co原创 2017-07-31 17:23:17 · 197 阅读 · 0 评论 -
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 point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,0原创 2017-07-30 20:28:56 · 138 阅读 · 0 评论 -
非常可乐
大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S Input三个整数 : S 可乐的体积 , N 和 M是两个杯子的容量,以"0 0 0"原创 2017-08-01 11:18:07 · 171 阅读 · 0 评论 -
Pots POJ
You are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i) fill the pot i (1 ≤ i ≤ 2) from the tap;DROP(i) empty the pot i to the原创 2017-08-01 17:17:24 · 244 阅读 · 0 评论 -
Rescue ZOJ
Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M Angel's friends want to save Angel. Their task is: approach Angel. We assume that "approach原创 2017-08-02 15:12:32 · 212 阅读 · 0 评论 -
Fire UVA
直接放题目链接吧UVA11624一开始比较犯晕,不知道怎么下手,因为火和人都在动,后来看了眼分析瞬间有了思路,人是受火的牵制的,先让火自由蔓延,即先对火跑一遍BFS,得到火到达每一块地方的时间,然后人再跑一遍BFS,根据火到达每一块地方的时间来判断能不能走,只要越过边界就直接退出,即得到了最小时间。需要注意的是,着火点F不止有一个,一开始我对每一个F点都跑一遍BFS,意料之中超时,然后改进原创 2017-08-03 21:22:34 · 174 阅读 · 0 评论 -
A计划
可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主的肉也能长生不老。年迈的国王正是心急如焚,告招天下勇士来拯救公主。不过公主早已习以为常,她深信智勇的骑士LJ肯定能将她救出。现据密探所报,公主被关在一个两层的迷宫里,迷宫的入口是S(0,0,0),公主的位置用P表示,时空传输机用#表示,墙用*原创 2017-08-04 10:17:16 · 592 阅读 · 0 评论 -
542. 01 Matrix
Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.The distance between two adjacent cells is 1.Example 1: Input:0 0 00 1 00 0 0Output:0 0 00 1 00 0原创 2017-12-08 21:48:55 · 170 阅读 · 0 评论