码迷,mamicode.com
首页 >  
搜索关键字:palindrome numbers    ( 9163个结果
HDU 3117 Fibonacci Numbers(Fibonacci矩阵加速递推+公式)
题目意思很简单:求第n个Fibonacci数,如果超过八位输出前四位和后四位中间输出...,否则直接输出Fibonacci数是多少。 后四位很好求,直接矩阵加速递推对10000取余的结果就是。 前四位搜了一下:http://blog.csdn.net/xieqinghuang/article/details/7789908 Fibonacci的通项公式,对,fibonacci数是有通...
分类:其他好文   时间:2014-09-29 13:52:51    阅读次数:301
Ruby基本语法规则
1.Ruby常用数据类型Numbers, Strings, Booleansmy_num = 25my_boollean = true (or false)my_string = "Ruby"2.Ruby常用数学计算操作符加(+) 减 (-)乘 (*)除(/)幂次方 (**)求余 (%)3...
分类:其他好文   时间:2014-09-28 19:38:45    阅读次数:213
leetcode 2SUM
structvp{intvalue;intplace;};boolcomp(conststructvpa,conststructvpb){returna.valuetwoSum(vector&numbers,inttarget){vectorv;for(inti=0;itarget){break.....
分类:其他好文   时间:2014-09-28 14:27:32    阅读次数:210
[LeetCode]Two Sum
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
leetcode - Palindrome Partitioning
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
密码生成器(python)
#!/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语言程序设计现代方法_数组(第八章)
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
URAL - 1297 Palindrome(后缀数组求最长回文子串)
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
URAL 1297 Palindrome 后缀数组+RMQ
本题是利用后缀数组求最长的回文串。方法是将字符串反转之后拼接到原来的字符串末尾,中间用一个没有出现过的分割符隔开,原因是防止最长公共前缀横跨两个串。之后分别枚举回文串的中点,以及回文串长度是奇数还是偶数,看一下对应位置的最长公共前缀即可。这里的求最长公共前缀要处理RMQ问题,线段树固然可以解决,但是...
分类:其他好文   时间:2014-09-26 22:10:08    阅读次数:142
SGU 108. Self-numbers 2 离线+位优化
可以像筛选法那样标记 但是内存最多只能开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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!