很简单的题目,不过还是觉得要说一下。最小深度,很快想到bfs,层序遍历嘛。本科的时候实在是没写过多少代码,一开始居然想不到怎么保存一层的信息。后来想到可以压入一个特殊的对象,每次到达这个对象就知道是一层了。我用的是空指针,觉得这个适用性还是不错的。一层的节点入队结束后,应该压入一个NULL,当一层的节点都处理完,遇到NULL的时候,要在队列尾部再入队一个NULL,这是后一层的分界线嘛。
昨天在另...
分类:
其他好文 时间:
2014-05-08 11:09:28
阅读次数:
315
写题解之前首先要感谢妹子。
比较容易的斜率DP,设sum[i]=Σb[j],sum_[i]=Σb[j]*j,w[i]为第i个建立,前i个的代价。 那么就可以转移了。
备注:还是要感谢妹子。/**************************************************...
分类:
其他好文 时间:
2014-05-08 10:24:20
阅读次数:
260
一次通过: 1 public class Solution { 2 public int
romanToInt(String s) { 3 int sum = 0; 4 int[] num = new int[s.length()]; 5 if...
分类:
其他好文 时间:
2014-05-08 08:24:26
阅读次数:
233
问题描述
给定(可能是负的)整数序列A1, A2,...,AN, 寻找(并标识)使Sum(Ak)(k >=i, k <= j)的值最大的序列。如果所有的整数都是负的,那么连续子序列的最大和是零。...
分类:
其他好文 时间:
2014-05-08 01:49:14
阅读次数:
273
链接:http://poj.org/problem?id=1775
Description
John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contributions to the foundations of m...
分类:
其他好文 时间:
2014-05-07 23:57:32
阅读次数:
402
简单:e sum of the squares of the first ten natural
numbers is,12 + 22 + ... + 102 = 385The square of the sum of the first ten
natural numbers is,(1 + 2 ...
分类:
其他好文 时间:
2014-05-07 20:23:43
阅读次数:
338
题目链接 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,...
分类:
其他好文 时间:
2014-05-07 16:42:42
阅读次数:
287
Problem:Work out the first ten digits of the
sum of the following one-hundred 50-digit
numbers.3710728753390210279879799822083759024651013574025046376...
分类:
其他好文 时间:
2014-05-07 13:34:38
阅读次数:
299
Sum It UpTime Limit:1000MSMemory Limit:10000KTotal
Submissions:5684Accepted:2894DescriptionGiven a specified total t and a list of
n integers, find al...
分类:
其他好文 时间:
2014-05-07 10:45:02
阅读次数:
388
1、查看所有表的物理大小1 select segment_name, bytes from
user_segments order by bytes desc2、查看表空間的名稱及大小1 select t.tablespace_name,
round(sum(bytes/(1024*1024)),....
分类:
数据库 时间:
2014-05-07 00:30:02
阅读次数:
1232