这是亚麻的OA 题 这里的代码没有经过测试 Given a binary tree, find the subtree with maximum sum. Return the root of the subtree. another similar problem in leetcode : ht ...
分类:
其他好文 时间:
2018-01-16 18:24:59
阅读次数:
120
1. 打表 打表是一种典型的用空间换时间的技巧,一般将所有可能需要用到的结果事先计算出来,这样后面需要用到时就可以直接查表获得。打表常见的用法有如下几种: 在程序中一次性计算出所有需要用到的结果,之后的查询直接取这些结果。例如在一个需要大量查询 Fibonacci 数的问题中,则可以把所有 Fibo ...
分类:
编程语言 时间:
2018-01-16 12:25:10
阅读次数:
197
People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6 digit number, wher ...
分类:
其他好文 时间:
2018-01-15 18:51:07
阅读次数:
122
高级特性生成器读取生成器元素的两种方式:?g.next()?for循环读取; (生成器实质上是可迭代对象);?列表生成式(列表生成式是Python 内置的非常简单却强大的可以用来创建 list的生成式), 当生成时元素即打印, 会占用内存; [i for i in range(100)] Fibonacci数列:1, 1,2, 3, 5,8, 13, 2
分类:
编程语言 时间:
2018-01-15 00:25:36
阅读次数:
177
问题描述 Fibonacci数列的递推公式为:Fn=Fn-1+Fn-2,其中F1=F2=1。当n比较大时,Fn也非常大,现在我们想知道,Fn除以10007的余数是多少。 输入格式 输入包含一个整数n。 输出格式 输出一行,包含一个整数,表示Fn除以10007的余数。 说明:在本题中,答案是要求Fn除 ...
分类:
其他好文 时间:
2018-01-10 14:14:13
阅读次数:
124
from __future__ import division import nltk nltk.download() from nltk.book import * #搜索文本 text1.concordance("monstrous") #出现在相似上下文中德词汇 text1.similar("... ...
分类:
编程语言 时间:
2018-01-08 21:06:21
阅读次数:
187
Predictor Variable 自变量 Experimental Variable 因变量,实验变量 Control Variable 1. list all potential var2. if have no data, remove var3. combine similar var4. ...
分类:
其他好文 时间:
2018-01-08 11:00:55
阅读次数:
173
RectMask2D 矩形2D遮罩 A RectMask2D is a masking control similar to the Mask control. The mask restricts the child elements to the rectangle of the parent ...
分类:
编程语言 时间:
2018-01-02 23:20:50
阅读次数:
1905
题目: 题目描述 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统。但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能高于前一发的高度。某天,雷达捕捉到敌国的导弹来袭。由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹。 输入导弹依次 ...
分类:
其他好文 时间:
2017-12-31 22:29:24
阅读次数:
222
【bzoj2796】 [Poi2012]Fibonacci Representation Description Fib数列0,1,1,2,3,5,8,13,21。 给出一个数字,用FIB数列各项加加减减来得到。例如 10=5+5 19=21-2 17=13+5-1 1070=987+89-5-1 ...
分类:
其他好文 时间:
2017-12-29 12:15:54
阅读次数:
140