Fibonacci数列定义为 $$f_n = f_{n-1}+f_{n-2}, \text{以及初值}f_0=0, f_1=1.$$ 本文之讨论,皆在模$10^9+7$意义下。 FIBOSUM 给定$0 \le x \le y \le 10^9$,求$\sum_{i=x}^y f_i$。 解: 令$ ...
分类:
其他好文 时间:
2017-08-27 13:29:16
阅读次数:
207
题目描述 Sort a linked list in O(n log n) time using constant space complexity. 思路:时间复杂度为O(nlogn),空间复杂度为常数,用归并排序 在下的代码 时间1162ms 空间27696k /** * Definition ...
分类:
其他好文 时间:
2017-08-27 12:52:56
阅读次数:
216
现有一篇英文作文,让你从中找出出现频率最高的n个单词 As can be seen from the chart that money value of annual global electronic transactions id increasing gradually in the seve ...
分类:
编程语言 时间:
2017-08-27 12:52:48
阅读次数:
227
1、centos最小化安装很有可能没装vsftpd(这么说是因为,非最小化安装有可能装了的) chkconfig –list | grep vsftpd 没有任何反应 yum –y install vsftpd #-y的作用?回答安装过程中一切的问题 2、创建日志文件 touch /var/log/ ...
分类:
其他好文 时间:
2017-08-27 12:49:34
阅读次数:
145
题目链接:http://poj.org/problem?id=1061 解题思路: 设两只青蛙跳了t次以后才会碰面。则有: x + mt = y + nt + Lk (k为任意整数) (1) (m - n)t + Lk = y - x (2) 用扩展欧几里得求解。设求出来的 gcd(m-n,L) = ...
分类:
其他好文 时间:
2017-08-27 12:48:14
阅读次数:
98
static function utf8_to_unicode($c) { switch(strlen($c)) { case 1: return ord($c); case 2: $n = (ord($c[0]) & 0x3f) > 6); $... ...
分类:
其他好文 时间:
2017-08-27 12:47:17
阅读次数:
118
public static function utf8_to_gbk($utfstr) { return iconv("utf-8", "gbk//IGNORE", $utfstr); } static function gbk_to_utf8($gbstr) { return mb_convert... ...
分类:
其他好文 时间:
2017-08-27 12:45:28
阅读次数:
114
1.安装express-session npm install express-session --save-dev //注意-g无效 2.app.jsvar session = require('express-session'); app.use(cookieParser()); //必须在此行 ...
分类:
其他好文 时间:
2017-08-27 12:45:22
阅读次数:
155
1.异步读取文件:var fs= require('fs'); // 从文件系统中读取请求的文件内容 fs.readFile(pathname.substr(1), function (err, data) { if (err) { console.log(err); // HTTP 状态码: 40 ...
分类:
Web程序 时间:
2017-08-27 11:59:52
阅读次数:
158