Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example: Given the below binary tree, 1 ...
分类:
其他好文 时间:
2014-07-30 20:33:34
阅读次数:
193
这几道题倒写得很顺利,看来这几天还是有点小进步的T_T....这道题最初只是想到可能会出现循环,后来看了个博客的分析,着重有两点1、对于公式 f[n] = A * f[n-1] + B * f[n-2]; 后者只有7 * 7 = 49 种可能,为什么这么说,因为对于f[n-1] 或者 f[n-2] ...
分类:
其他好文 时间:
2014-07-30 20:22:44
阅读次数:
221
Windows操作系统使用Maximum Transmission Unit (MTU) 来确定在下面的网络层上可以传输的协议数据包(protocol data packet)的最大尺寸. MTU参数通常出现在与某一个接口(网卡, 串口等)的通信中, 并且每个接口都是分开设置的. 为了达到最优的网络...
F - Dragon Balls
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d
& %I64u
Submit Status
Description
Five hundred years later, the number of dragon balls will increa...
分类:
其他好文 时间:
2014-07-30 17:44:23
阅读次数:
282
注意问题:
1)字符串是空指针的情况。
2)如果输入的是一个空字符串“”
3)所有‘0’到‘9’之外的字符都是非法的吗?加号和减号是合法输入。
4) 考虑溢出
#include
using namespace std;
bool g_value=false;
int atoi(char * number){
if(number == NULL || *nu...
分类:
其他好文 时间:
2014-07-30 17:37:04
阅读次数:
182
Problem Description
Given a positive integer n, your task is to find a positive integer m, which is a multiple of n, and that m contains the least number of different digits when represented in decim...
分类:
其他好文 时间:
2014-07-30 14:46:03
阅读次数:
230
Thread.java源码中:
ThreadLocal.ThreadLocalMap threadLocals = null;即:每个Thread对象都有一个ThreadLocal.ThreadLocalMap成员变量,ThreadLocal.ThreadLocalMap是一个ThreadLocal类的静态内部类(如下所示),所以Thread类可以进行引用.
static class Th...
分类:
编程语言 时间:
2014-07-30 12:24:43
阅读次数:
200
Single Number I
问题描述:
Given an array of integers, every element appears twice except for one. Find that single one.
解题思路:
既然除了某个元素出现一次外,其他所有元素都出现两次,那么可以异或数组的所有元素,得到的结果就是我们所要找的那个元素的值。
class Solu...
分类:
其他好文 时间:
2014-07-30 12:19:53
阅读次数:
184
Find DigitsProblem StatementGiven a number you have to print how many digits in that number exactly divides that number.Input formatThe first line con...
分类:
其他好文 时间:
2014-07-30 11:55:13
阅读次数:
250
题意:给你一个序列,找两个长度为 k 且没有重合区间的数使得其和最大解题思路:1)线段树想了半天想不出只能先用线段树撸了一发,这题dp 第一名只要了 9分钟。就是把起点为 i 长度为 k 的和预处理出来,再用线段树枚举去找。解题代码: 1 // File Name: 332b.cpp 2 // .....
分类:
其他好文 时间:
2014-07-30 11:46:03
阅读次数:
373