码迷,mamicode.com
首页 >  
搜索关键字:consecutive numbers    ( 8082个结果
LeetCode:Decode Ways
题目链接A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message c...
分类:其他好文   时间:2014-09-25 01:02:47    阅读次数:240
HDU 3117 Fibonacci Numbers(矩阵快速幂+公式)
题目地址:HDU 3117 对于后四位可以用矩阵快速幂快速求出来,但前四位就没办法了。要知道斐波那契数列是有通项公式的,所以只能通过通项公式来求前四位,但公式不能求后四位,因为公式使用浮点数求的,精度显然不够,求前四位要用到对数。 通项公式为: f(n)=1/sqrt(5)(((1+sqrt(5))/2)^n+((1-sqrt(5))/2)^n) 假设F[n]可以表示成 t * 10^...
分类:其他好文   时间:2014-09-24 22:17:08    阅读次数:249
[数位dp] lightoj 1205 Palindromic Numbers
题意:给定范围内是回文数的个数。 思路:...
分类:其他好文   时间:2014-09-24 22:14:18    阅读次数:178
LeetCode——Permutations
PermutationsGiven a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3]...
分类:其他好文   时间:2014-09-24 04:02:35    阅读次数:212
UVA 10081 Tight numbers(POJ 2537)
直接看代码就OK。思路比较简单。就是注意概率要在转移过程中算出来。不能算成成立的方案书除以总方案数(POJ的这道题可以这么干。数据很水么。另外POJ要用%.5f,%.5lf 会WA。)#include #include #include #include #include #include #i.....
分类:其他好文   时间:2014-09-23 20:45:55    阅读次数:198
[LeetCode][I]Permutations II
Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example, [1,1,2] have the following unique permutations: [1,1,2], [1,2,1], and [2,1,1]....
分类:其他好文   时间:2014-09-23 17:07:24    阅读次数:222
POJ3641_Pseudoprime numbers【快速幂】【伪素数】
题目大意:费马定理:a^p = a(mod p) (a为大于1的整数,p为素数),一些非素数p,同样也符合上边的 定理,这样的p被称作基于a的伪素数,给你p和a,判断p是否是基于a的伪素数 思路:很简单的快速幂取余+素性判断 如果p为素数,则直接输出no 如果p不为素数,则进行快速幂取余判断是否为伪素数,若是,输出yes,不是,输出no...
分类:其他好文   时间:2014-09-23 08:30:34    阅读次数:248
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-22 23:28:53    阅读次数:160
找出最大连续自然数个数[Longest Consecutive Sequence in an Unsorted Array]
Longest Consecutive Sequence in an Unsorted Array
分类:其他好文   时间:2014-09-22 21:18:33    阅读次数:124
【LeetCode】Sum Root to Leaf Numbers 解题报告
【题目】 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 represents the number 123. Fin...
分类:其他好文   时间:2014-09-22 19:30:53    阅读次数:175
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!