题目:
Roman numerals come from the ancient Roman numbering system. They are based on specific letters of the alphabet which are combined to signify the sum (or, in some cases, the difference) of th...
分类:
其他好文 时间:
2014-06-20 12:27:09
阅读次数:
394
题目要求 1000 内可以被 3 或者 5 整除的数字之和
可以很简单地这么写:
print sum( [ i for i in xrange( 1000 ) if i % 3 == 0 or i % 5 == 0 ] )
但是对于10^10的数据,要运行很长时间,可以利用一点鸽巢原理
10^10中能被 3 整除的数据和加上能被 5 整除的数据和减去能被 15 整除的数据和即可,求...
分类:
其他好文 时间:
2014-06-20 11:46:19
阅读次数:
249
Find the contiguous subarray within an array
(containing at least one number) which has the largest sum.For example, given
the array[?2,1,?3,4,?1,2,1,...
分类:
其他好文 时间:
2014-06-20 08:59:38
阅读次数:
235
PathsumDescription:Given a binary tree and a
sum, determine if the tree has a root-to-leaf path such that adding up all the
values along the path equa...
分类:
其他好文 时间:
2014-06-08 01:11:46
阅读次数:
395
Given amxngrid filled with non-negative
numbers, find a path from top left to bottom right whichminimizesthe sum of all
numbers along its path.Note:Yo...
分类:
其他好文 时间:
2014-06-07 20:22:17
阅读次数:
264
Given a binary tree and a sum, determine if the
tree has a root-to-leaf path such that adding up all the values along the path
equals the given sum.Fo...
分类:
其他好文 时间:
2014-06-07 16:55:09
阅读次数:
173
题目
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary t...
分类:
其他好文 时间:
2014-06-07 15:31:32
阅读次数:
179
题目
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum
= 22,
5
...
分类:
其他好文 时间:
2014-06-07 13:47:22
阅读次数:
191
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.
3
7 4
2 4 6
8 5 9 3
That is, 3 + 7 + 4 + 9 = 23.
Find th...
分类:
其他好文 时间:
2014-06-07 13:45:25
阅读次数:
189
update #temp
set #temp.Recycle=case when UnionA.num>0 then 1 else 0 end
from (select GradeID,sum(num)as num from AreaAllot
where CHARINDEX(@Area,AreaAllot.Area)=1 and LEN(@Area)=LEN(Area)-2
...
分类:
数据库 时间:
2014-06-07 12:57:44
阅读次数:
304