假如F[1] = a, F[2] = B, F[n] = F[n - 1] + F[n - 2]。写成矩阵表示形式可以很快发现F[n] = f[n - 1] * b + f[n - 2] * a。 f[n] 是斐波那契数列也就是我们如果知道一段区间的前两个数增加了多少,可以很快计算出这段区间的第k个...
分类:
其他好文 时间:
2014-07-31 09:47:46
阅读次数:
286
数位DP。。。。
Palindromic Numbers
Time Limit: 2000MS
Memory Limit: 32768KB
64bit IO Format: %lld & %llu
[Submit] [Go Back] [Status]
Description
A palindro...
分类:
其他好文 时间:
2014-07-31 03:04:56
阅读次数:
247
Round Numbers
Time Limit: 2000MS
Memory Limit: 65536KB
64bit IO Format: %I64d & %I64u
[Submit] [Go Back]
[Status]
Description
The cows, as you know, have no...
分类:
其他好文 时间:
2014-07-31 00:08:55
阅读次数:
350
Description
The Fibonacci sequence is the sequence of numbers such that every element is equal to the sum of the two previous elements, except for the first two elements f0 and f1 which are respect...
分类:
其他好文 时间:
2014-07-31 00:08:05
阅读次数:
281
问题描述:
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
For example,
If n = 4 and k = 2, a solution is:
[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]
解题思路...
分类:
其他好文 时间:
2014-07-31 00:04:35
阅读次数:
204
题目描述 Give you a lot of positive integers, just to find out how many prime numbers there are.. In each case, there is an integer N representing the num...
分类:
其他好文 时间:
2014-07-30 23:35:35
阅读次数:
300
Fibonacci Numbers
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1766 Accepted Submission(s): 695
Problem Description
The Fibon...
分类:
其他好文 时间:
2014-07-30 20:50:54
阅读次数:
276
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...
分类:
其他好文 时间:
2014-07-30 11:30:33
阅读次数:
247
基本输入输出
5.1基本输出
print XXX //同一行输出
println XXX //换行输出
输出字符串:
def message ="My name is Michael"
println("here is :"+${message})
输出列表和映射
def numbers =[11,12,13,14]
println "Numbers:${nu...
分类:
其他好文 时间:
2014-07-30 10:08:13
阅读次数:
287
题目:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], ...
分类:
编程语言 时间:
2014-07-30 09:58:03
阅读次数:
218