Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu...
分类:
编程语言 时间:
2014-10-01 02:29:00
阅读次数:
222
题目来源:POJ 1046 Color Me Less题目大意:每一个颜色由R、G、B三部分组成,D=Math.sqrt(Math.pow((left.red - right.red), 2)+ Math.pow((left.green - right.green), 2)+ Math.pow((l...
分类:
其他好文 时间:
2014-09-30 02:39:52
阅读次数:
339
//结构示例:public struct Person{ string Name; int height; int weight}public bool overWeight(){ //implement something} 类示例: public class Test...
分类:
其他好文 时间:
2014-09-29 21:44:21
阅读次数:
167
最近看到这样的一个题目求X的N次方,自己想了一些解决办法,记录一下留作日后参考...
分类:
其他好文 时间:
2014-09-29 19:34:01
阅读次数:
129
Lucas定理这里有详细的证明。其实就是针对n, m很大时,要求组合数C(n, m) % p, 一般来说如果p 2 #include 3 #include 4 using namespace std; 5 6 #define N 100010 7 8 long long mod_pow(i...
分类:
其他好文 时间:
2014-09-28 22:10:55
阅读次数:
192
直接lucas降到10w以内搞组合数
#include
#include
typedef __int64 LL;
LL f[110010];
LL pow(LL a, LL b, LL c)
{
LL ans = 1;
while(b)
{
if(b&1)
ans = (ans*a) % c;
b >>= 1;
a = (a*a) % c;
}
return an...
分类:
其他好文 时间:
2014-09-28 21:49:55
阅读次数:
216
今天在做一个按更新时间搜寻出某个目录里面的全部文件,因为自己写算法比較花费时间,干脆就用j2se提供的类Arrays提供的sort()方法,这样就比較省力。对于基本数据类型仅仅要Arrays.sort(数组)[“注:数组是声明为基本数据类型的数组,如int[]等”]对于对象类型,要implement...
分类:
其他好文 时间:
2014-09-28 21:13:45
阅读次数:
152
BigInteger / BigDecimal / string 一些常用的函数:加 add减 substract乘 multiply除 divid取余 mod次幂 pow(int)比较 compareTo / equals判断是否某string开头(是否0开头) startsWith("0").....
分类:
编程语言 时间:
2014-09-28 00:18:50
阅读次数:
323
Last night , I attended writting examination for Bai Du,There is a problem, ask us implement a state machine to deleting the comments in c,I don't k.....
分类:
编程语言 时间:
2014-09-27 10:43:39
阅读次数:
178
Implement pow(x, n).
public class Solution {
public double pow(double x, int n) {
if(n>0) return powInt(x,n);
else return 1/powInt(x,-n);
}
private double powInt(double x, int n){
if...
分类:
其他好文 时间:
2014-09-26 20:00:48
阅读次数:
112