码迷,mamicode.com
首页 >  
搜索关键字:number    ( 26994个结果
java中23种设计模式之5-多例模式(multition pattern)
顾名思义,多例模式相对于单例模式,就是可以有多于一个的有限实例,如下列,只能有两个实例。import java.util.ArrayList;import java.util.Random;class Multition{ private final static int MAX_NUMBER=2;...
分类:编程语言   时间:2015-03-30 21:03:30    阅读次数:166
【LeetCode OJ】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...
分类:其他好文   时间:2015-03-30 20:38:15    阅读次数:122
js ==与===区别(两个等号与三个等号)
1、对于string,number等基础类型,==和===是有区别的1)不同类型间比较,==之比较“转化成同一类型后的值”看“值”是否相等,===如果类型不同,其结果就是不等2)同类型比较,直接进行“值”比较,两者结果一样2、对于Array,Object等高级类型,==和===是没有区别的进行“指针...
分类:Web程序   时间:2015-03-30 20:23:01    阅读次数:154
Codeforces Round #117 (Div. 2)---D. Common Divisors
Vasya has recently learned at school what a number’s divisor is and decided to determine a string’s divisor. Here is what he came up with.String a is the divisor of string b if and only if there exists...
分类:其他好文   时间:2015-03-30 18:51:43    阅读次数:134
LeetCode 191 Number of 1 Bits
题目描述: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-bit integer ’11' has binary representa...
分类:其他好文   时间:2015-03-30 18:42:17    阅读次数:128
Codeforces 245H Queries for Number of Palindromes
题意:给你一个字符串,再给你一个q(询问个数1000000),问你这个区间内回文串的个数。解题思路:1)dp,先把 i 到j 是回文串的真值赋值给 dp[i][j] ,然后从后往前dp dp[i][j] += dp[i+1][j] + dp[i][j-1] -dp[i+1][j-1];解题代码: ....
分类:其他好文   时间:2015-03-30 18:19:19    阅读次数:145
LeetCode Plus One
Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is at the head of the list. 题意:大数加法。 class Soluti...
分类:其他好文   时间:2015-03-30 16:33:20    阅读次数:91
[矩阵快速幂] CodeForces 392C Yet Another Number Sequence
题意: 题目意思很明朗~ 思路: A(n+1)=F(n+1)*(n+1)^k A(n)=F(n)*(n)^k A(n-1)=F(n-1)*(n-1)^k 这里拿k=2来举例 A(n+1)=F(n)*(n+1)^2+F(n-1)*(n+1)^2 对于A(n+1)发现可以由A(n)和A(n-1)得到 实际上就是多了 2*n+1个F(n) 和4*n个F(n-1) 其实就是n^k ->...
分类:其他好文   时间:2015-03-30 16:31:26    阅读次数:159
leetcode:Factorial Trailing Zeroes
Given an integern, return the number of trailing zeroes inn!.最初的代码class Solution {public: int trailingZeroes(int n) { long long int fac = 1; ...
分类:其他好文   时间:2015-03-30 16:18:19    阅读次数:121
[leetcode] N-Queens II
N-Queens IIFollow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions. 1 class Solutio...
分类:其他好文   时间:2015-03-30 16:17:44    阅读次数:141
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!