随笔分类 - ACM---dfs
摘要:Problem Description Kelukin is a businessman. Every day, he travels around cities to do some business. On August 17th, in memory of a great man, citiz
阅读全文
摘要:Problem Description ztr loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits o
阅读全文
摘要:Problem Description These few days, Baby Ming is addicted to playing a matrix game. Given a n∗m matrix, the character in the matrix(i∗2,j∗2) (i,j=0,1,
阅读全文
摘要:X 国王有一个地宫宝库。是n x m 个格子的矩阵。每个格子放一件宝贝。每个宝贝贴着价值标签。 地宫的入口在左上角,出口在右下角。 小明被带到地宫的入口,国王要求他只能向右或向下行走。 走过某个格子时,如果那个格子中的宝贝价值比小明手中任意宝贝价值都大, 小明就可以拿起它(当然,也可以不拿)。 当小
阅读全文
摘要:描述 神秘的海洋,惊险的探险之路,打捞海底宝藏,激烈的海战,海盗劫富等等。加勒比海盗,你知道吧?杰克船长驾驶着自己的的战船黑珍珠1号要征服各个海岛的海盜,最后成为海盗王。 这是一个由海洋、岛屿和海盗组成的危险世界。面对危险重重的海洋与诡谲的对手,如何凭借智慧与运气,建立起一个强大的海盗帝国。 杰克船
阅读全文
摘要:Problem DescriptionYou are givenNsets.Thei−th set hasAinumbers.You should divide the sets intoLparts.And each part should have at least one number in ...
阅读全文
摘要:Problem DescriptionThere are many unsolvable problem in the world.It could be about one or about zero.But this time it is about bigger number. Given a...
阅读全文
摘要:DescriptionThe cows have a line of 20 water bowls from which they drink. The bowls can be either right-side-up (properly oriented to serve refreshing ...
阅读全文
摘要:DescriptionYou are to write a program that tries to find an optimal coloring for a given graph. Colors are applied to the nodes of the graph and the o...
阅读全文
摘要:DescriptionIn 1976 the ``Four Color Map Theorem" was proven with the assistance of a computer. This theorem states that every map can be colored using...
阅读全文
摘要:DescriptionA thief is running away!We can consider the city where he locates as an undirected graph in which nodes stand for crosses and edges stand f...
阅读全文
摘要:Problem DescriptionThe 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...
阅读全文
摘要:Problem DescriptionThere was no donkey in the province of Gui Zhou, China. A trouble maker shipped one and put it in the forest which could be conside...
阅读全文
摘要:描述One day,Tom’s girlfriend give him an array A which contains N integers and asked him:Can you choose some integers from the N integers and the sum of...
阅读全文
摘要:描述There is a game which is called 24 Point game.In this game , you will be given some numbers. Your task is to find an expression which have all the g...
阅读全文
摘要:描述今天是阴历七月初五,acm队员zb的生日。zb正在和C小加、never在武汉集训。他想给这两位兄弟买点什么庆祝生日,经过调查,zb发现C小加和never都很喜欢吃西瓜,而且一吃就是一堆的那种,zb立刻下定决心买了一堆西瓜。当他准备把西瓜送给C小加和never的时候,遇到了一个难题,never和C...
阅读全文
摘要:Problem Description呃......变形课上Harry碰到了一点小麻烦,因为他并不像Hermione那样能够记住所有的咒语而随意的将一个棒球变成刺猬什么的,但是他发现了变形咒语的一个统一规律:如果咒语是以a开头b结尾的一个单词,那么它的作用就恰好是使A物体变成B物体. Harry已经...
阅读全文
摘要:Problem DescriptionI have N precious stones, and plan to use K of them to make a necklace for my mother, but she won't accept a necklace which is too ...
阅读全文
摘要:题目大意:有n个点,把这些点分别放到两个集合里,在两个集合的每个点之间都会有权值,求可能形成的最大权值。思路:1、把这两个集合标记为0和1,先默认所有点都在集合0里。 2、依次枚举每个点id,把每个点都放到集合1里去,这个时候就要调整集合的权值了,原来和id都在集合0里的点,要把权值加上;...
阅读全文
摘要:题目大意:给出一个方格矩阵,矩阵中有数字0~9,任选一个格子为起点,将走过的数字连起来构成一个数,找出最大的那个数,每个格子只能走一次。题目分析:DFS。剪枝方案:在当前的处境下,找出所有还能到达的点的个数,若当前数字的长度加上个数仍小于目前最优答案的长度,则剪去;若长度相等,则将所有还能到达的数字...
阅读全文