摘要: 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。 Input测试输入包含若干测试用例。每个测试用例的第1行给出 阅读全文
posted @ 2017-08-07 10:05 zzzying 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize 阅读全文
posted @ 2017-08-06 20:31 zzzying 阅读(147) 评论(0) 推荐(0) 编辑
摘要: The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D 阅读全文
posted @ 2017-08-05 16:01 zzzying 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 大家常常感慨,要做好一件事情真的不容易,确实,失败比成功容易多了! 做好“一件”事情尚且不易,若想永远成功而总从不失败,那更是难上加难了,就像花钱总是比挣钱容易的道理一样。 话虽这样说,我还是要告诉大家,要想失败到一定程度也是不容易的。比如,我高中的时候,就有一个神奇的女生,在英语考试的时候,竟然把 阅读全文
posted @ 2017-08-01 20:32 zzzying 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 新年快到了,“猪头帮协会”准备搞一个聚会,已经知道现有会员N人,把会员从1到N编号,其中会长的号码是N号,凡是和会长是老朋友的,那么该会员的号码肯定和N有大于1的公约数,否则都是新朋友,现在会长想知道究竟有几个新朋友?请你编程序帮会长计算出来。 Input第一行是测试数据的组数CN(Case num 阅读全文
posted @ 2017-08-01 20:30 zzzying 阅读(208) 评论(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-07-29 16:12 zzzying 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 这题只要利用链表的思想,用数组模拟就可以很快的做出来且不会超时 阅读全文
posted @ 2017-07-25 21:18 zzzying 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 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. 阅读全文
posted @ 2017-07-25 21:14 zzzying 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 输入一行数字,如果我们把这行数字中的‘5’都看成空格,那么就得到一行用空格分割的若干非负整数(可能有些整数以‘0’开头,这些头部的‘0’应该被忽略掉,除非这个整数就是由若干个‘0’组成的,这时这个整数就是0)。 你的任务是:对这些分割得到的整数,依从小到大的顺序排序输出。 Input输入包含多组测试 阅读全文
posted @ 2017-07-24 21:36 zzzying 阅读(136) 评论(0) 推荐(0) 编辑
摘要: A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. 阅读全文
posted @ 2017-07-24 21:33 zzzying 阅读(177) 评论(0) 推荐(0) 编辑