随笔分类 -  图论-深搜(DFS)

摘要:You have been employed by the organisers of a Super Krypton Factor Contest in which contestants have very high mental and physical abilities. In one s 阅读全文
posted @ 2018-01-31 20:39 Zireael 阅读(189) 评论(0) 推荐(0)
摘要:Given a set of sticks of various lengths, is it possible to join them end to end to form a square? Input The first line of input contains N, the numbe 阅读全文
posted @ 2017-12-07 17:05 Zireael 阅读(196) 评论(0) 推荐(0)
摘要:蜘蛛牌是windows xp操作系统自带的一款纸牌游戏,游戏规则是这样的:只能将牌拖到比她大一的牌上面(A最小,K最大),如果拖动的牌上有按顺序排好的牌时,那么这些牌也跟着一起移动,游戏的目的是将所有的牌按同一花色从小到大排好,为了简单起见,我们的游戏只有同一花色的10张牌,从A到10,且随机的在一 阅读全文
posted @ 2017-11-30 19:02 Zireael 阅读(240) 评论(0) 推荐(0)
摘要:Absent minded Masha got set of n cubes for her birthday. At each of 6 faces of each cube, there is exactly one digit from 0 to 9. Masha became interes 阅读全文
posted @ 2017-11-23 20:05 Zireael 阅读(259) 评论(0) 推荐(0)
摘要:Recently Luba bought a very interesting book. She knows that it will take t seconds to read the book. Luba wants to finish reading as fast as she can. 阅读全文
posted @ 2017-11-20 20:29 Zireael 阅读(1287) 评论(0) 推荐(0)
摘要:Consider a un rooted tree T which is not the biological significance of tree or plant, but a tree as an undirected graph in graph theory with n nodes, 阅读全文
posted @ 2017-11-18 20:24 Zireael 阅读(236) 评论(0) 推荐(0)
摘要:一个规则的实心十二面体,它的 20个顶点标出世界著名的20个城市,你从一个城市出发经过每个城市刚好一次后回到出发的城市。 Input 前20行的第i行有3个数,表示与第i个城市相邻的3个城市.第20行以后每行有1个数m,m=1.m=0退出. Output 输出从第m个城市出发经过每个城市1次又回到m 阅读全文
posted @ 2017-11-13 20:27 Zireael 阅读(130) 评论(0) 推荐(0)
摘要:Vasily has a number a, which he wants to turn into a number b. For this purpose, he can do two types of operations: multiply the current number by 2 ( 阅读全文
posted @ 2017-10-18 21:08 Zireael 阅读(435) 评论(0) 推荐(0)
摘要:Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other o 阅读全文
posted @ 2017-09-03 11:58 Zireael 阅读(331) 评论(0) 推荐(0)
摘要:Description 可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主的肉也能长生不老。年迈的国王正是心急如焚,告招天下勇士来拯救公主。不过公主早已习以为常,她深信智勇的骑士LJ肯定能将她救出。  阅读全文
posted @ 2017-08-26 13:43 Zireael 阅读(152) 评论(0) 推荐(0)
摘要: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 f 阅读全文
posted @ 2017-08-09 16:40 Zireael 阅读(188) 评论(0) 推荐(0)
摘要: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 m 阅读全文
posted @ 2017-08-09 10:35 Zireael 阅读(229) 评论(0) 推荐(0)
摘要:题意: 给出油田的数量,八连通的“@”认为是一个油田。和POJ 2386 Lake Counting这个题几乎一样。 直接上代码: 阅读全文
posted @ 2017-08-08 11:09 Zireael 阅读(169) 评论(0) 推荐(0)
摘要: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 adjacen 阅读全文
posted @ 2017-08-08 10:27 Zireael 阅读(149) 评论(0) 推荐(0)
摘要:在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。 你的任务是,对于给定的N,求出有多少种合法的放置方法。 Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output共有若 阅读全文
posted @ 2017-08-07 16:36 Zireael 阅读(203) 评论(0) 推荐(0)
摘要:B. Two Buttons time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output B. Two Buttons time limit 阅读全文
posted @ 2017-07-27 17:28 Zireael 阅读(340) 评论(0) 推荐(0)
摘要:Red and Black Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a bla 阅读全文
posted @ 2017-06-10 20:38 Zireael 阅读(159) 评论(0) 推荐(0)
摘要:棋盘问题 Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数 阅读全文
posted @ 2017-06-10 18:57 Zireael 阅读(271) 评论(0) 推荐(0)
摘要:题意:有一个大小为N×M的园子,雨后积起了水。八连通的积水被认为是连在一起的。求园子里一共有多少水洼? * * * * W* (八连通指的就是左图中相对W的*的部分) * * * Sample Input Sample Output 阅读全文
posted @ 2017-06-03 11:52 Zireael 阅读(1877) 评论(0) 推荐(0)