12 2012 档案
摘要:一年前的今天,在我浑浑噩噩的生活中,梁婆急急地就去了。一年了。你虚度了吗?回首时,莫要悔恨!Earn this. Earn it. 失去的,我会都找回来。我来了,2013。
阅读全文
摘要:最近读书比之前多了不少,逐渐感觉到自己的语言能力有了比较明显的退化。主要表现在:输入。在读逻辑性比较高的文字的时候,经常会有读不进去的感觉,就如思绪浮在文字表面上。以前虽然也有这种情况(比如上学的时候学的思想政治……),但是现在明显感觉这种情况出现的频率高了很多。输出。在说和写上,经常出现词不达意,表达方式不连贯,词汇量萎缩等情况。 我想,出现语言能力这种情况,主要是受到网络化的阅读方式的影响。1.以微博为代表的网络阅读模式,以短,浅为特点。长期使用这种阅读方式,则对长文,有深度的文字的理解能力会有所下降。见过一位大牛曾就这微博式阅读使长文阅读能力丧失这一问题有一个很深刻的解剖,相当精彩...
阅读全文
摘要:题目16:2的1000次方的各位之和是多少?215= 32768 并且其各位之和为 3 + 2 + 7 + 6 + 8 = 26.21000的各位数之和是多少?挺简单,将21000用str()处理成字符串类型。print(sum(int(i) for i in str(2**1000)))再给个很naive的做法。。= =View Code digits = [1]def time2(): temp = 0 for d in range(len(digits)): double = digits[d] * 2 digits[d] = double % 1...
阅读全文
摘要:题目14:找出以100万以下的数字开始的最长序列。以下迭代序列定义在整数集合上:nn/2 (当n是偶数时)n3n+ 1 (当n是奇数时)应用以上规则,并且以数字13开始,我们得到以下序列:134020105168421可以看出这个以13开始以1结束的序列包含10个项。虽然还没有被证明(Collatz问题),但是人们认为在这个规则下,以任何数字开始都会以1结束。以哪个不超过100万的数字开始,能给得到最长的序列?注意:一旦序列开始之后,也就是从第二项开始,项是可以超过100万的。3n+1问题。View Code 1 maxn = 1000000 2 length = [0 for i in ra
阅读全文
摘要:Problem 13Work out the first ten digits of the sum of the following one-hundred 50-digit numbers....(100个50位数)...为了避免有后面低位进位的情况,取了每个50位数的前13位来运算。1 def pe013BF():2 data = open('013.txt', "r")3 sum1 = str(sum([int(line[:13]) for line in data]))[:10]4 return sum15 6 if __name__ ==
阅读全文
摘要:Problem 12The sequence of triangle numbers is generated by adding the natural numbers. So the 7thtriangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...Let us list the factors of the first seven triangle numbers:1: 13: 1,36: 1,2,
阅读全文
摘要:Problem 11In the 2020 grid below, four numbers along a diagonal line have been marked in red.08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 0849 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 0081 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 6552 70 95 23 04 60 11 42 69 24
阅读全文
摘要:Problem 10The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million.开始的思路是逐个数做素性判断,然后做成素数表或直接累加。View Code import timedef pe010BF(n): t1 = time.time() sumOfPrime = 2 for k in range(3, n, 2): isPrime = True for i in range(3, int(k**1/2...
阅读全文

浙公网安备 33010602011771号