摘要: 你有一个日志文件,里面记录着各种系统事件的详细信息。自然的,事件的时间戳按照严格递增顺序排列(不会有两个事件在完全相同的时刻发生)。 遗憾的是,你的系统被病毒感染了,日志文件中混入了病毒生成的随机伪事件(但真实事件的相对顺序保持不变)。备份的日志文件也被感染了,但由于病毒采用的随机感染方法,主日志文 阅读全文
posted @ 2017-08-21 22:02 Pretty9 阅读(230) 评论(0) 推荐(0)
摘要: We all love recursion! Don't we? Consider a three-parameter recursive function w(a, b, c): if a <= 0 or b <= 0 or c <= 0, then w(a, b, c) returns: 1 i 阅读全文
posted @ 2017-08-21 21:59 Pretty9 阅读(199) 评论(0) 推荐(0)
摘要: The multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the r 阅读全文
posted @ 2017-08-21 21:58 Pretty9 阅读(211) 评论(0) 推荐(0)
摘要: The company "21st Century Fruits" has specialized in creating new sorts of fruits by transferring genes from one fruit into the genome of another one. 阅读全文
posted @ 2017-08-21 21:56 Pretty9 阅读(220) 评论(0) 推荐(0)
摘要: In a few months the European Currency Union will become a reality. However, to join the club, the Maastricht criteria must be fulfilled, and this is n 阅读全文
posted @ 2017-08-21 21:54 Pretty9 阅读(259) 评论(0) 推荐(0)
摘要: A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = <x1, x2, ..., xm> another se 阅读全文
posted @ 2017-08-21 21:53 Pretty9 阅读(228) 评论(0) 推荐(0)
摘要: JGShining's kingdom consists of 2n(n is no more than 500,000) small cities which are located in two parallel lines. Half of these cities are rich in r 阅读全文
posted @ 2017-08-21 21:52 Pretty9 阅读(216) 评论(0) 推荐(0)
摘要: A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence ( a1, a2, ..., aN) be any sequence ( ai1, 阅读全文
posted @ 2017-08-21 21:49 Pretty9 阅读(232) 评论(0) 推荐(0)
摘要: Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the 阅读全文
posted @ 2017-08-21 21:47 Pretty9 阅读(174) 评论(0) 推荐(0)
摘要: Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in th 阅读全文
posted @ 2017-08-21 21:46 Pretty9 阅读(228) 评论(0) 推荐(0)
摘要: Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrix a with n 阅读全文
posted @ 2017-08-21 21:45 Pretty9 阅读(271) 评论(0) 推荐(0)
摘要: 在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的: 有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少? 已经告诉你了,这是个DP的题目,你能AC吗? Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个 阅读全文
posted @ 2017-08-21 21:44 Pretty9 阅读(195) 评论(0) 推荐(0)
摘要: 1698: 送外卖 题目描述 在美团和饿了么大行其道的今天,囊中羞涩的小周和小美,也随大流加入了配送员的行列。每天下课后,他们都去堕落街帮北京烤鸭店送外卖。 过了好些日子,小周发现每次送外卖,小美总比自己先回来,就算自己拼命跑啊跑,也总是比她慢,明明小美也是和自己一样,走着去送外卖的(等外卖的都饿死 阅读全文
posted @ 2017-08-21 21:36 Pretty9 阅读(352) 评论(0) 推荐(0)
摘要: 1009: 格雷码 题目描述 对于给定的正整数n,格雷码为满足如下条件的一个编码序列:(1) 序列由2^n个编码组成,每个编码都是长度为n的二进制位串。(2) 序列中无相同的编码。(3) 序列中位置相邻的两个编码恰有一位不同。例如:n=2时的格雷码为:{00, 01, 11, 10}。 对于给定的正 阅读全文
posted @ 2017-08-21 21:34 Pretty9 阅读(304) 评论(0) 推荐(0)
摘要: 1051: 最长的波动序列 题目描述 有一个长度为N的整数序列,序列里面的数是两两不同的,现在要在里面找一个波动序列,这个序列越长越好。 比如有波动序列{a0,a1,a2…an},则a0 > a1 < a2 > a3 < … 有一个长度为N的整数序列,序列里面的数是两两不同的,现在要在里面找一个波动 阅读全文
posted @ 2017-08-21 21:32 Pretty9 阅读(238) 评论(0) 推荐(0)
摘要: 1253: Problem C: Babelfish 题目描述 Problem C: Babelfish You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialec 阅读全文
posted @ 2017-08-21 21:29 Pretty9 阅读(205) 评论(0) 推荐(0)
摘要: 1258: Time 题目描述 Digital clock use 4 digits to express time, each digit is described by 3*3 characters (including”|”,”_”and” “).now given the current t 阅读全文
posted @ 2017-08-21 21:28 Pretty9 阅读(153) 评论(0) 推荐(0)
摘要: 1257: You are my brother 题目描述 Little A gets to know a new friend, Little B, recently. One day, they realize that they are family 500 years ago. Now, L 阅读全文
posted @ 2017-08-21 21:26 Pretty9 阅读(290) 评论(0) 推荐(0)
摘要: 1437: 无题 题目描述 tc在玩一个很无聊的游戏:每一次电脑都会给一个长度不超过10^5的字符串,tc每次都从第一个字符开始,如果找到两个相邻相一样的字符,就会把它们删除掉,然后再重新从第一个字符开始,直到不能找到这样的字符, 这样tc就得胜了。 你能帮助tc吗? tc在玩一个很无聊的游戏:每一 阅读全文
posted @ 2017-08-21 21:24 Pretty9 阅读(225) 评论(0) 推荐(0)
摘要: 1636: 心电图 题目描述 众所周知,ACM/ICPC实验室聚集了一堆学霸Orz 有学霸的地方就有学渣。而每次考试以后,就是学渣最痛苦的时候。尤其是成绩揭晓的时候,那心情就像十五个吊桶打水————七上八下的。 作为一个学渣,他是不能很好地预计这门考试的成绩的。有时候呢,本来以为考的还行的,结果考下 阅读全文
posted @ 2017-08-21 21:23 Pretty9 阅读(152) 评论(0) 推荐(0)
摘要: 1690: 千纸鹤 题目描述 圣诞节快到了,校园里到处弥漫着粉红色的气息。又是一个情侣秀恩爱的节日。 作为一只在双十一剁手的单身狗,XX只能望着空荡荡的钱包欲哭无泪。 XX琢磨着,得趁圣诞节的时候赚点外快,不然真得喝西北风去了。 但是能赚什么外快呢?批发苹果?没本金;卖贺卡?没本金;许愿灯?还是没本 阅读全文
posted @ 2017-08-21 21:21 Pretty9 阅读(150) 评论(0) 推荐(0)
摘要: 1639: 分糖果 题目描述 为了实验室的发展,吴大大采购了一箱零食O(∩_∩)O~~ 在吴大大取快递的时候,实验室已经已经默默地聚集了一堆吃货,准备抢劫他,为了避免发生由一袋零食引发的血案,同时也是为了体现我们实验室的和谐,在实验室的N个人达成了一个协议:等吴大大一回来,大家就包围他!但是每个人必 阅读全文
posted @ 2017-08-21 21:19 Pretty9 阅读(133) 评论(0) 推荐(0)
摘要: 1520: 压缩编码 题目描述 某工业监控设备不断发回采样数据。每个数据是一个整数(0到1000之间)。各个数据间用空白字符(空格,TAB或回车换行)分隔。 因为大多数时候,相邻的采样间隔数据是相同的,可以利用这个特征做数据的压缩存储。其方法是:对n(n>1)个连续相同的数字只记录n和该数字本身;对 阅读全文
posted @ 2017-08-21 21:17 Pretty9 阅读(165) 评论(0) 推荐(0)
摘要: 1681: 机器人走格子 题目描述 一个长X宽Y的棋盘,有XY个格子。将机器人放在某个格子中,机器人可以沿上、下、左、右四个方向走一步到相邻的格子中,但不会越过棋盘边界。 问机器人要经过所有的格子至少一次并最终回到起点最少需要多少步?规则允许机器人多次走过同一个格子。对于X=Y=1的情形,我们认为答 阅读全文
posted @ 2017-08-21 21:15 Pretty9 阅读(434) 评论(0) 推荐(0)
摘要: 1695: 跳格子 题目描述 逸夫楼的大厅的地面有10行10列的石砖,我们用坐标(x,y)来表示石砖的位置。如图示: 一天lxl在逸夫楼大厅玩跳格子游戏,跳格子游戏有7个动作:1.向左转,2向右转,3向后转,4向左跳一格,5向前跳一格,6向右跳一格,7向后跳一格。游戏前,lxl在(1,1)处并面向y 阅读全文
posted @ 2017-08-21 21:12 Pretty9 阅读(319) 评论(0) 推荐(0)
摘要: 1617: Graph 题目描述 Your task is to judge whether a regular polygon can be drawn only by straightedge and compass. The length of the straightedge is infi 阅读全文
posted @ 2017-08-21 21:09 Pretty9 阅读(597) 评论(0) 推荐(0)
摘要: 1675: Morse Code 题目描述 摩尔斯电码(英语:Morse Code)是一种时通时断的信号代码,通过不同的排列顺序来表达不同的英文字母、数字和标点符号。是由美国人萨缪尔·摩尔斯在1836年发明。 --摘自维基百科 摩尔斯电码的代码有点(.),划(-)以及停顿组成。 常见的字符编码见下表 阅读全文
posted @ 2017-08-21 21:06 Pretty9 阅读(198) 评论(0) 推荐(0)
摘要: 1638: 遍地桔子 题目描述 为了实验室的发展,队长决定在实验室外面的空地种桔子树。空地划分为N×M个格子,每个格子为1×1,队长买了N×M棵树苗。买树苗的时候,老板免费赠送了K袋肥料,这些肥料非常强力,可以使施肥格子和前后左右四个相邻格子(如果存在的话)中的桔子树产量加1。队长表示还想买肥料,但 阅读全文
posted @ 2017-08-21 21:04 Pretty9 阅读(290) 评论(0) 推荐(0)
摘要: 1521: 塔防游戏 题目描述 小明最近迷上了塔防游戏,塔防游戏的规则就是在地图上建炮塔,用于防御敌军的进攻。 这里我们假设地图是一个n行m列的格子,每个炮塔只能建在格子里,这里的炮塔有点奇怪,因为它只能攻击它自己所在行和所在列的格子(包括自身),并且每两个塔既不能放在同一列也不能放在同一行;现在小 阅读全文
posted @ 2017-08-21 21:02 Pretty9 阅读(164) 评论(0) 推荐(0)
摘要: 1565: Vampire Numbers 题目描述 The number 1827 is an interesting number, because 1827=21*87, and all of the same digits appear on both sides of the `='. T 阅读全文
posted @ 2017-08-21 20:59 Pretty9 阅读(384) 评论(0) 推荐(0)
摘要: 1559: Vive la Difference! 题目描述 Take any four positive integers: a, b, c, d. Form four more, like this: | a - b|,| b - c|,| c - d|,| d - a| That is, ta 阅读全文
posted @ 2017-08-21 20:56 Pretty9 阅读(214) 评论(0) 推荐(0)
摘要: 1558: Flooring Tiles 题目描述 You want to decorate your floor with square tiles. You like rectangles. With six square flooring tiles, you can form exactly 阅读全文
posted @ 2017-08-21 20:53 Pretty9 阅读(355) 评论(0) 推荐(0)
摘要: 1600: BCD时钟 题目描述 BCD码是指用四位二进制数来表示十进制数中的0~9这十个数字的编码形式,常见的是8421码表如下: 十进制 二进制 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 现在我们用 阅读全文
posted @ 2017-08-21 20:50 Pretty9 阅读(317) 评论(0) 推荐(0)