问题来自知乎
腾讯的笔试题
等我写完之后发现不就是那啥啥函数,贴上lua代码
N很大的时候,估计是抗不住了,代码还需要优化。
function banana( n )
local c = 1;
if n == 0 then
return 0
elseif n == 1 then
return 1
elseif n ==...
分类:
其他好文 时间:
2015-04-10 22:10:23
阅读次数:
143
看了斌神的题解恍然大悟http://www.kuangbin.net/archives/bc36
代码:
#include
#include
#include
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const int N = 200005;
int t, n, m, f[N], r...
分类:
其他好文 时间:
2015-04-09 21:58:18
阅读次数:
161
Problem Description
Given two strings, you have to tell the length of the Longest Common Substring of them.For example:
str1 = banana
str2 = cianaicSo the Longest Common Substring is “ana”, and the...
分类:
编程语言 时间:
2015-04-09 15:33:59
阅读次数:
225
1.安装之前需要的准备:所需软件libevent-1.4.6这个版本网上没找到,所以安装最新的版本libevent-2.0.22libevent-1.4.6-stable.tar.gz (http://monkey.org/~provos/libevent/)memcache-2.2.3.tgz (...
分类:
Web程序 时间:
2015-04-08 13:09:48
阅读次数:
140
*#type.jsfunction Person(name, age) { this.name = name; this.age = age;}var d = {an: 'object'};var a = ['apple', 'banana'];var f = function() {};var s...
分类:
编程语言 时间:
2015-04-08 07:58:26
阅读次数:
184
代理困扰了很久,一直看概念,看网上的博客发现不是自己要的!我想要的是一个代理流程。 第一个界面的名字,姑且我们叫apple吧!第二个界面的名字叫banana;在banana中的值想传给apple,这时候就要用到代理了,可以用其他的传值吗?可以,不过我们先研究代理传值。 banana传值,ba...
分类:
移动开发 时间:
2015-04-07 19:36:12
阅读次数:
184
hdu 5201 The Monkey King 母函数 泰勒展开
题意:
有n个苹果,m个人,要求分给第一个人最多,其他人随意,求有多少种分法。最后结果模1000000007。
限制:
1
思路:
母函数,泰勒展开
枚举第一个人分到的苹果,设为u,
剩下的苹果为n-u个,分成m-1份,则有:
生成函数为:
G(x)=(1+x+x^2+...+x^(u-1))^(m-...
分类:
其他好文 时间:
2015-04-07 12:00:58
阅读次数:
114
1004 - Monkey Banana Problem
PDF (English)
Statistics
Forum
Time Limit: 2 second(s)
Memory Limit: 32 MB
You are in the world of mathematics to solve the gre...
分类:
其他好文 时间:
2015-04-07 09:47:46
阅读次数:
134
JS数组带有一个unshift方法可以再数组前面添加若干个元素,下面是详细的代码演示<pid="demo">Clickthebuttontoaddelementstothearray.</p><buttonit</button><script>functionmyFunction(){varfruits=["Banana","Orange","Apple","Mango"];fruits.u..
分类:
编程语言 时间:
2015-04-06 18:54:17
阅读次数:
215
Trie (字典树)"A", "to", "tea", "ted", "ten", "i", "in", "inn" 这些单词组成的字典树.Radix Tree (基数树)基数树与字典树的区别在于基数树将单词压缩了, 节点变得更少Suffix Tree (后缀树)单词 "BANANA" 的后缀树. ...
分类:
其他好文 时间:
2015-04-06 18:35:44
阅读次数:
212