[leetcode] Latest added:2014-09-23Find the contiguous subarray within an array (containing at least one number) which has the largest product.For exam...
分类:
编程语言 时间:
2014-09-28 01:51:00
阅读次数:
499
题目地址:ZOJ 3690
假设F(n)表示前n个人第n个人选择的数大于k的个数,G(n)表示的是前n个人第n个人选择的数小于等于k的个数
那么F(n) = F(n-1)*(m-k)+G(n-1)*(m-k) , G(n) = F(n-1)*k+G(n-1)*(k-1) , 那么最后的结果就是F(n)+G(n);
那么我们可以构造出矩阵
| m-k m-k| | F(...
分类:
其他好文 时间:
2014-09-28 00:28:00
阅读次数:
175
Bitset
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 12693 Accepted Submission(s): 9772
Problem Description
Give you a number on b...
分类:
其他好文 时间:
2014-09-27 23:36:10
阅读次数:
184
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 an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime...
分类:
其他好文 时间:
2014-09-27 18:53:40
阅读次数:
204
第一题:设 S(N)表示 N 的各位数字之和,如 S(484)=4+8+4=16,S(22)=2+2=4。如果一个正整数 x满足 S(x*x)=S(x)*S(x),我们称 x 为 Rabbit Number。比方说,22 就是一个 Rabbit Number,因为 S(484)=S(22)*S(22...
分类:
其他好文 时间:
2014-09-27 17:00:50
阅读次数:
221
为了a异或b的和最大,只需另b在不大于n的情况下按位取反即可。这里有两个输出小技巧可以参考:1.在用printf输出__int64时,在windows下使用格式"%I64d",在linux下使用"%lld",在hdu中应使用"%I64d",如果拿不准就是用cout好了。2.在遇到每个数之间有空格,最...
分类:
其他好文 时间:
2014-09-27 12:20:39
阅读次数:
178
a letter and a number
时间限制:3000 ms | 内存限制:65535 KB
难度:1
描述we define f(A) = 1, f(a) = -1, f(B) = 2, f(b) = -2, ... f(Z) = 26, f(z) = -26;
Give you a letter x and a number y , you should o...
分类:
其他好文 时间:
2014-09-27 10:42:09
阅读次数:
184
/*gcvt(将浮点型数转换为字符串,取四舍五入)相关函数 ecvt,fcvt,sprintf表头文件 #include定义函数 char *gcvt(double number,size_t ndigits,char *buf);函数说明 gcvt()用来将参数number...
分类:
其他好文 时间:
2014-09-27 02:07:39
阅读次数:
275
这里只记录C#的特色地方
1、params关键字,本关键字在于可变长参数的利用,比如
static void countNumbers(params int vals) {
foreach(val in vals) {
Console.write("current number is {0}" , val);
}
}
调用的时候可以传入任意数量的数字,比如countNumbers...
分类:
其他好文 时间:
2014-09-26 23:59:48
阅读次数:
385