06 2018 档案
摘要:Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 1
阅读全文
摘要:1049 Counting Ones (30)(30 分) The task is simple: given any positive integer N, you are supposed to count the total number of 1's in the decimal form
阅读全文
摘要:/********************** author: yomi date: 18.6.17 ps: 突然想到以序列合并代替快排,have a try! 这么想的原因是A1029 这种方法以O(n)的复杂度打败了我的快排O(nlogn) 然鹅,我忽视了一个问题,题目给的是递增序列,这是使用merge的前提条件。 我居然还以为我发现了又一排序算法。这么一想,归并...
阅读全文
摘要:1093 Count PAT's (25)(25 分) The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, a
阅读全文
摘要:1044 Shopping in Mars (25)(25 分) Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (
阅读全文
摘要:1010 Radix (25)(25 分) Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is "yes", if 6 is a dec
阅读全文