Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol...
分类:
其他好文 时间:
2014-07-09 23:00:38
阅读次数:
208
You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that the Ts d...
分类:
其他好文 时间:
2014-07-09 15:35:19
阅读次数:
176
Python学习(3)切片(Slice):根据索引范围取出字符串里面的内容,比如: l=range(100) l[:8] [0, 1, 2, 3, 4, 5, 6, 7] l[:10:2] [0, 2, 4, 6, 8]list、tuple、set 、字符串都可以做切片操作迭代(iteration)...
分类:
编程语言 时间:
2014-07-09 14:48:16
阅读次数:
160
题目
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent
a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Find ...
分类:
其他好文 时间:
2014-07-08 21:43:08
阅读次数:
219
http://acm.hdu.edu.cn/showproblem.php?pid=4722
大致题意:若一个整数的各位数字之和是10的倍数,称这个数为"good number"。给出区间[A,B],求出该区间内"good number"的数的个数。
第一道数位dp,折腾了半天才明白怎么回事。
设dp[site][mod]表示到第site位(由高位向低位)前面各位数字之和对1...
分类:
其他好文 时间:
2014-07-08 20:46:41
阅读次数:
223
杭电服务器是慢啊。。
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define ll long long
#define N 1000005
sets;
ll ans[1783]={
126,153,688,1206,1255,1260,...
分类:
其他好文 时间:
2014-07-08 18:58:12
阅读次数:
252
def Fibonacci(n):
if n <= 0:
return 0
if n <= 1:
return n
f0 = 0; f1 = 1
for i in range(2, n + 1):
fn = f0 + f1
f0 = f1
f1 = fn
return fn...
分类:
其他好文 时间:
2014-07-08 16:42:03
阅读次数:
163
You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that the 1’s ...
分类:
其他好文 时间:
2014-07-08 13:34:40
阅读次数:
195
1、Swift 无需写break,所以不会发生这种贯穿(fallthrough)的情况。
2、//用不到变量名,可用“_”替换
for _ in 1...power
{
answer *= base
}
3、case 可以匹配更多的类型模式,包括区间匹配(range matching),元组(tuple)和特定类型的描述。
可以这样用case
case 1...3:
natura...
分类:
其他好文 时间:
2014-07-06 00:52:44
阅读次数:
194
A message containing letters from A-Z is being encoded to numbers using the following mapping:
'A' -> 1
'B' -> 2
...
'Z' -> 26
Given an encoded message containing digits, determine the total numb...
分类:
其他好文 时间:
2014-07-05 23:41:41
阅读次数:
253