摘要: 一.输入查找输入Phone ListGiven a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let's say the phone catalogue listed these numbers:- Emergency 911- Alice 97 625 999- Bob 91 12 54 26In this case, it's not possible to call Bob, because the c 阅读全文
posted @ 2013-08-04 17:24 会笑的虫 阅读(326) 评论(1) 推荐(0)
摘要: Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a given positive integer have? For example, the integer 53 has two representations 5 + 7 + 11 + 13 + 17 and 53. The integer 41 has three representations 2+3+5+7+11+13, 11+1 阅读全文
posted @ 2013-07-16 20:31 会笑的虫 阅读(270) 评论(0) 推荐(0)
摘要: In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus the sum of the digits of n. (The d stands for digitadition, a term coined by Kaprekar.) For example, d(75) = 75 + 7 + 5 = 87. Given any positive inte 阅读全文
posted @ 2013-07-16 20:20 会笑的虫 阅读(243) 评论(0) 推荐(0)