随笔分类 -  DFS

摘要:迷宫城堡 Problem Description 为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(N<=10000)和M条通道(M<=100000),每个通道都是单向的,就是说若称某通道连通了A房间和B房间,只说明可以通过这个通道由A房间到达B房间,但并不说明通过它可以由B房间到 阅读全文
posted @ 2016-03-31 13:07 ACMSaga 阅读(360) 评论(0) 推荐(0)
摘要:Fire Net Problem Description 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, ea 阅读全文
posted @ 2016-03-30 21:32 ACMSaga 阅读(150) 评论(0) 推荐(0)
摘要:逃离迷宫 Problem Description 给定一个m × n (m行, n列)的迷宫,迷宫中有两个位置,gloria想从迷宫的一个位置走到另外一个位置,当然迷宫中有些地方是空地,gloria可以穿越,有些地方是障碍,她必须绕行,从迷宫的一个位置,只能走到与它相邻的4个位置中,当然在行走过程中 阅读全文
posted @ 2016-03-30 21:12 ACMSaga 阅读(337) 评论(0) 推荐(0)
摘要:题目链接 Problem Description Fill the following 8 circles with digits 1~8,with each number exactly once . Conntcted circles cannot be filled with two cons 阅读全文
posted @ 2016-02-09 14:40 ACMSaga 阅读(274) 评论(0) 推荐(0)
摘要:题目链接 Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum 阅读全文
posted @ 2016-02-07 20:35 ACMSaga 阅读(123) 评论(0) 推荐(0)
摘要:题目链接 Problem Description 有一种纸牌游戏,很有意思,给你N张纸牌,一字排开,纸牌有正反两面,开始的纸牌可能是一种乱的状态(有些朝正,有些朝反),现在你需要整理这些纸牌。但是麻烦的是,每当你翻一张纸牌(由正翻到反,或者有反翻到正)时,他左右两张纸牌(最左边和最右边的纸牌,只会影 阅读全文
posted @ 2016-02-03 18:36 ACMSaga 阅读(756) 评论(0) 推荐(0)
摘要:题目链接 Problem Description The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one lar 阅读全文
posted @ 2016-02-03 17:18 ACMSaga 阅读(179) 评论(0) 推荐(0)
摘要:题目链接 Problem Description Zty is a man that always full of enthusiasm. He wants to solve every kind of difficulty ACM problem in the world. And he has 阅读全文
posted @ 2016-02-03 17:05 ACMSaga 阅读(167) 评论(0) 推荐(0)
摘要:题目链接 Problem Description 可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主的肉也能长生不老。年迈的国王正是心急如焚,告招天下勇士来拯救公主。不过公主早已习以为常,她深信智勇的 阅读全文
posted @ 2016-01-31 13:19 ACMSaga 阅读(411) 评论(0) 推荐(0)
摘要:题目链接 Problem Description A while ago I had trouble sleeping. I used to lie awake, staring at the ceiling, for hours and hours. Then one day my grandmo 阅读全文
posted @ 2016-01-30 15:56 ACMSaga 阅读(358) 评论(0) 推荐(0)
摘要:题目链接 Problem Description Given a specified total t and a list of n integers, find all distinct sums using numbers from the list that add up to t. For 阅读全文
posted @ 2016-01-28 22:26 ACMSaga 阅读(160) 评论(0) 推荐(0)
摘要:题目链接 题解:题意为给出一个N*M的矩阵,然后(i∗2,j∗2) (i,j=0,1,2...)的点处是数字,两个数字之间是符号,其他位置是‘#’号。 但不知道是理解的问题还是题目描述的问题,数据中还有类似1#1这种数据存在,因此WA了4次,加上了一句代码后,马上AC了,该行代码在下文以斜粗体标出。 阅读全文
posted @ 2016-01-28 14:22 ACMSaga 阅读(194) 评论(0) 推荐(0)
摘要:题目链接 Problem Description The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shak 阅读全文
posted @ 2016-01-26 15:40 ACMSaga 阅读(140) 评论(0) 推荐(0)
摘要:题目链接 Problem Description “连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于 阅读全文
posted @ 2016-01-25 21:38 ACMSaga 阅读(230) 评论(0) 推荐(0)