题目意思很简单:求第n个Fibonacci数,如果超过八位输出前四位和后四位中间输出...,否则直接输出Fibonacci数是多少。
后四位很好求,直接矩阵加速递推对10000取余的结果就是。
前四位搜了一下:http://blog.csdn.net/xieqinghuang/article/details/7789908
Fibonacci的通项公式,对,fibonacci数是有通...
分类:
其他好文 时间:
2014-09-29 13:52:51
阅读次数:
301
1.Ruby常用数据类型Numbers, Strings, Booleansmy_num = 25my_boollean = true (or false)my_string = "Ruby"2.Ruby常用数学计算操作符加(+) 减 (-)乘 (*)除(/)幂次方 (**)求余 (%)3...
分类:
其他好文 时间:
2014-09-28 19:38:45
阅读次数:
213
structvp{intvalue;intplace;};boolcomp(conststructvpa,conststructvpb){returna.valuetwoSum(vector&numbers,inttarget){vectorv;for(inti=0;itarget){break.....
分类:
其他好文 时间:
2014-09-28 14:27:32
阅读次数:
210
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu...
分类:
其他好文 时间:
2014-09-27 23:31:00
阅读次数:
186
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = "aab",
Return
[
["aa","...
分类:
其他好文 时间:
2014-09-27 20:16:10
阅读次数:
211
#!/usr/bin/envpython
importrandom
importstring
importsys
similar_char=‘0OoiI1LpP‘
upper=‘‘.join(set(string.uppercase)-set(similar_char))
lower=‘‘.join(set(string.lowercase)-set(similar_char))
symbols=‘!#$%&\*+,-./:;=?@^_`~‘
numbers=‘123456789‘
group=(..
分类:
编程语言 时间:
2014-09-27 18:38:20
阅读次数:
192
C语言不要求检查下标的范围。当下标超出范围时,程序可能会执行不可预知的行为。看下这个程序:#include #define N 10 //int main(){ int a[N],i; printf("Enter %d numbers: ",N); for(i=0; i=0;...
分类:
编程语言 时间:
2014-09-27 01:26:59
阅读次数:
222
Description
The “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent from the competing «Robots Unlimited» has infiltrated into “U.S. Robotics”. «U.S. R...
分类:
其他好文 时间:
2014-09-26 22:34:29
阅读次数:
370
本题是利用后缀数组求最长的回文串。方法是将字符串反转之后拼接到原来的字符串末尾,中间用一个没有出现过的分割符隔开,原因是防止最长公共前缀横跨两个串。之后分别枚举回文串的中点,以及回文串长度是奇数还是偶数,看一下对应位置的最长公共前缀即可。这里的求最长公共前缀要处理RMQ问题,线段树固然可以解决,但是...
分类:
其他好文 时间:
2014-09-26 22:10:08
阅读次数:
142
可以像筛选法那样标记 但是内存最多只能开1024的int数组 我用了位优化 用一个int 32 位标记32个数字 接下来就离线 排个序 算出第k大的哪个数
#include
#include
#include
using namespace std;
int a[10000000/32];
struct node
{
int x, y, id;
}b[50010];
int get(...
分类:
其他好文 时间:
2014-09-26 20:31:58
阅读次数:
162