Problem Description:
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you ...
分类:
其他好文 时间:
2014-08-01 00:08:50
阅读次数:
274
#include #include using namespace std::placeholders;//lambda即匿名函数int main(){ int a = 10; //当return所有的返回都是一个类型就不需要指定返回值的类型,因为编译器会自动推断 //也可以指定返...
分类:
编程语言 时间:
2014-07-31 23:49:50
阅读次数:
351
需求:1、取cacti的图时不需要登陆(只对可访问用户开放),但其它操作时需要登陆。2、每天早上把报表发送到指定邮件需求1:file:/cacti/graph_p_w_picpath.php//include("./include/auth.php");
include("./include/global.php");品茶:首先去掉验证模块,发现少了涵数,再去au..
分类:
其他好文 时间:
2014-07-31 21:18:41
阅读次数:
625
定义枚举
public enum YesOrNo {
YES("是") ,
NO("否") ;
private String text ;
private int code ;
YesOrNo(){
this.text = this.name() ;
this.code = this.ordinal() ;
}
YesOrNo(String ...
分类:
编程语言 时间:
2014-07-31 21:03:31
阅读次数:
206
/*不可摸数
Problem Description
s(n)是正整数n的真因子之和,即小于n且整除n的因子和.例如s(12)=1+2+3+4+6=16.如果任何
数m,s(m)都不等于n,则称n为不可摸数.
Input
包含多组数据,首先输入T,表示有T组数据.每组数据1行给出n(2
Output
如果n是不可摸数,输出yes,否则输出no
Sample In...
分类:
其他好文 时间:
2014-07-31 21:02:27
阅读次数:
216
假设有数n
以前用除二取余法 复杂度logn 不多说
有一个logv的方法 v为1的个数 复杂度比logn小
int Count(int x)
{
int ans = 0;
while(x)
{
x &= (x-1);
ans++;
}
return ans;
}
这里用到了位运算 x&(x-1)每次去掉一个1 举个例子
100010001000&(10...
分类:
其他好文 时间:
2014-07-31 20:55:27
阅读次数:
225
$(document).bind("contextmenu", function () {
return false;
});
$(document).bind("selectstart", function () {
return false;
});...
分类:
Web程序 时间:
2014-07-31 20:53:37
阅读次数:
218
C++编译错误cannot have cv-qualifier
在C++中CV指const和volatile两个关键字。有两种情况不能使用CV限定。
一、非成员函数不能含有CV限定,即const和volatile限定
#include
using namespace std;
double getArea() const
{
return ...
分类:
编程语言 时间:
2014-07-31 20:52:07
阅读次数:
227
贪心,排序从大到小。。
先比大的,跑不过就拿最小的来送死。。,
如果是平局就比后面的。。。
若后面也是平局就拿去跟前面的去跑。。。
#include
#include
#include
#include
using namespace std;
int s[1005],w[1005];
int main()
{
int n,i;
while(scanf("...
分类:
其他好文 时间:
2014-07-31 20:50:47
阅读次数:
153
Problem Description:
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 numbers such that they...
分类:
其他好文 时间:
2014-07-31 20:48:17
阅读次数:
215