getActiveWorkbenchWindow 有如下声明
/**
* Returns the currently active window for this workbench (if any). Returns
* null if there is no active workbench window. Returns
* null if called from a non-...
克鲁斯卡尔
struct edge
{
int u, v, w;
}e[maxn];
int f[110];
bool cmp(edge a, edge b)
{
return a.w < b.w;
}
int find(int x)
{
if(x != f[x])
return f[x] = find(f[x]);
return f[x];
}
int MST()
{
int...
分类:
其他好文 时间:
2014-05-23 02:15:51
阅读次数:
267
看到这种填合适的运算符之类的题目,第一感觉就是用dfs来枚举递归。
但邮箱道题目算法设计里面那么大的数据,想到有可能会超时。
用最直白的简单的方法dfs一遍后交上,超时。
——需要判重和边界结束条件。
在所有能剪断的地方痛下狠手,狂加特判+return;
然后就炒鸡快了
#include
#include
#include
#define ADD 32000
using namespa...
分类:
其他好文 时间:
2014-05-23 02:06:42
阅读次数:
285
/** JQuery Html Encoding、Decoding
* 原理是利用JQuery自带的html()和text()函数可以转义Html字符
* 虚拟一个Div通过赋值和取值来得到想要的Html编码或者解码
*/
//Html编码获取Html转义实体
function htmlEncode(value){
return $('').text(value).html();
}
//...
分类:
Web程序 时间:
2014-05-23 01:23:28
阅读次数:
499
【题目】
Given 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], [2,3,1], [3,1,2], and [3,2,1].
【题意】
给定一个数组,生成所有的全排列
【思路】
递归,类DFS...
分类:
其他好文 时间:
2014-05-23 01:08:26
阅读次数:
194
介绍通过方法
@Override
public boolean areAllItemsEnabled() {
return false;
}
@Override
public boolean isEnabled(int position) {
return !mStrings[position].startsWith("-");
}
设置list的可以选和不可选注意有...
分类:
其他好文 时间:
2014-05-22 23:08:09
阅读次数:
388
作用域:在一定的空间范围内能够使用。
生存周期:在一定的时间范围内存在。
example:
int f(int x){
static int k=0;
x+=k++;
return x;
}
求f(f(2));
这个结果是2,其中上例中k是一个静态局部变量,它的作用域就是本函数体内部,而它的生存周期确实一直有效,也就是说该变量一旦声明了之后,在内存开辟了一个单元用来存放它,只有在...
分类:
其他好文 时间:
2014-05-22 22:45:05
阅读次数:
261
很和谐精悍的一行快排代码quicksort1。
import random
def quicksort( list ):
if list == []:
return []
else:
cut = list[0]
lesser = quicksort( [ x for x in list[1:] if x < cut ]...
分类:
其他好文 时间:
2014-05-22 22:33:19
阅读次数:
402
【题目】
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-05-22 17:32:17
阅读次数:
247
俗话说不作死就不会死,今天作死了一回,写了一个比较二逼的函数,遇到了同步Ajax引起的UI线程阻塞问题,在此记录一下。
事情起因是这样的,因为页面上有多个相似的异步请求动作,本着提高代码可重用性的原则,我封装了一个名为getData的函数,它接收不同参数,只负责获取数据,然后把数据return...
分类:
编程语言 时间:
2014-05-22 16:21:04
阅读次数:
328