摘要: 你有一个日志文件,里面记录着各种系统事件的详细信息。自然的,事件的时间戳按照严格递增顺序排列(不会有两个事件在完全相同的时刻发生)。 遗憾的是,你的系统被病毒感染了,日志文件中混入了病毒生成的随机伪事件(但真实事件的相对顺序保持不变)。备份的日志文件也被感染了,但由于病毒采用的随机感染方法,主日志文 阅读全文
posted @ 2017-08-21 22:02 Pretty9 阅读(209) 评论(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 阅读(180) 评论(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 阅读(192) 评论(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 阅读(207) 评论(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 阅读(239) 评论(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 阅读(214) 评论(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 阅读(189) 评论(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 阅读(212) 评论(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 阅读(156) 评论(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 阅读(208) 评论(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 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的: 有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少? 已经告诉你了,这是个DP的题目,你能AC吗? Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个 阅读全文
posted @ 2017-08-21 21:44 Pretty9 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 1698: 送外卖 题目描述 在美团和饿了么大行其道的今天,囊中羞涩的小周和小美,也随大流加入了配送员的行列。每天下课后,他们都去堕落街帮北京烤鸭店送外卖。 过了好些日子,小周发现每次送外卖,小美总比自己先回来,就算自己拼命跑啊跑,也总是比她慢,明明小美也是和自己一样,走着去送外卖的(等外卖的都饿死 阅读全文
posted @ 2017-08-21 21:36 Pretty9 阅读(326) 评论(0) 推荐(0) 编辑
摘要: 1009: 格雷码 题目描述 对于给定的正整数n,格雷码为满足如下条件的一个编码序列:(1) 序列由2^n个编码组成,每个编码都是长度为n的二进制位串。(2) 序列中无相同的编码。(3) 序列中位置相邻的两个编码恰有一位不同。例如:n=2时的格雷码为:{00, 01, 11, 10}。 对于给定的正 阅读全文
posted @ 2017-08-21 21:34 Pretty9 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 1051: 最长的波动序列 题目描述 有一个长度为N的整数序列,序列里面的数是两两不同的,现在要在里面找一个波动序列,这个序列越长越好。 比如有波动序列{a0,a1,a2…an},则a0 > a1 < a2 > a3 < … 有一个长度为N的整数序列,序列里面的数是两两不同的,现在要在里面找一个波动 阅读全文
posted @ 2017-08-21 21:32 Pretty9 阅读(204) 评论(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 阅读(193) 评论(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 阅读(124) 评论(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 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 1437: 无题 题目描述 tc在玩一个很无聊的游戏:每一次电脑都会给一个长度不超过10^5的字符串,tc每次都从第一个字符开始,如果找到两个相邻相一样的字符,就会把它们删除掉,然后再重新从第一个字符开始,直到不能找到这样的字符, 这样tc就得胜了。 你能帮助tc吗? tc在玩一个很无聊的游戏:每一 阅读全文
posted @ 2017-08-21 21:24 Pretty9 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 1636: 心电图 题目描述 众所周知,ACM/ICPC实验室聚集了一堆学霸Orz 有学霸的地方就有学渣。而每次考试以后,就是学渣最痛苦的时候。尤其是成绩揭晓的时候,那心情就像十五个吊桶打水————七上八下的。 作为一个学渣,他是不能很好地预计这门考试的成绩的。有时候呢,本来以为考的还行的,结果考下 阅读全文
posted @ 2017-08-21 21:23 Pretty9 阅读(138) 评论(0) 推荐(0) 编辑