When I finished reading this problem,I thought
I could solve it by scan every single subarray in the array,and the time
complexity is cubic.Every su.....
分类:
其他好文 时间:
2014-06-04 15:30:52
阅读次数:
255
这里以3次方来举例讲一下这题的做法,其它维类似。如果要求某一个值的3次方那么sum =
t^3,设t = x+y。那也就是sum = (x+y)^3.假如我让每个数都加z t = x+y+z,我可以让新的y =
y+z,这里发现新来的总会加在y上,那么可以给他一个延迟,slz,那么新的值t = t ...
分类:
其他好文 时间:
2014-06-03 16:14:05
阅读次数:
349
(from zhangwuji) $$\bex
\sum\limits_{n=0}^{\infty}\dfrac{n^3+2n+1}{(n^4+n^2+1)n!},\quad
\sum\limits_{n=0}^{\infty}\dfrac{1}{(n^4+n^2+1)n!}. \eex$$解答: ...
分类:
其他好文 时间:
2014-06-03 15:31:55
阅读次数:
252
题意:中文题。不说了。注意一些地方,机器的执行过程是没有顺序的,而且每个机器可以用多次。第一次执行的机器不消耗转移时间K。用dp[i][j]表示第i个机器完成第j个步骤的最短时间,sum[j][i]表示第i个机器完成前j个步骤的时间。比较容易想到一个朴素的状态转移方程:dp[i][j]=min{dp...
分类:
其他好文 时间:
2014-06-02 19:48:58
阅读次数:
261
1. 指针和地址TCPL 中给指针的定义是: A pointer is a group of
cells (often two or four) that can hold an address .int value = 10;int *pvalue =
&value;上面这个语句的内存模型是:注意...
分类:
其他好文 时间:
2014-06-02 18:07:49
阅读次数:
315
Max Sum Plus PlusTime Limit: 2000/1000 MS
(Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s):
15898Accepted Submission(s): 5171...
分类:
其他好文 时间:
2014-06-02 14:59:54
阅读次数:
247
问题描述:
Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).
If d(a) = b and d(b) = a, where a b, then a and b are
an amicable pair and each ...
分类:
编程语言 时间:
2014-06-02 12:31:42
阅读次数:
298
【题目】
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
【题意】
判断了两个二叉树是否相等
【思路】
递归...
分类:
其他好文 时间:
2014-06-02 11:03:03
阅读次数:
205
【题目】
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
Note:
A solution using O(n) space is pretty straight forward. Could you devise a constant space solution?
confused what "{1,#,2,3}" ...
分类:
其他好文 时间:
2014-06-02 10:38:17
阅读次数:
246
求和print(Array(1,7,2,9).sum)结果19要使用sum方法,元素类型必须是数值类型:要么是整形,要么是浮点数或者BigInteger/BigDecimal。print(ArrayBuffer("Mary","had","a","little","lamb").max)结果little排序valb=ArrayBuffer(1,7,2,9)
valbSorted=b.sorted
print(bSorted)..
分类:
其他好文 时间:
2014-06-02 03:23:26
阅读次数:
354