1、设置value为pxx的项选中
$(".selector").val("pxx");
2、设置text为pxx的项选中
$(".selector").find("option[text='pxx']").attr("selected",true);
这里有一个中括号的用法,中括号里的等号的前面是属性名称,不用加引号。很多时候,中括号的运用可以使得逻辑变得很简单...
分类:
Web程序 时间:
2014-08-04 11:05:27
阅读次数:
216
Smith Numbershttp://poj.org/problem?id=1142 1 #include 2 int fac[128]; 3 int find_fac(int n){//对n分解质因数,返回质因数个数 4 int cnt=0; 5 for(int i=2;i*i1...
分类:
其他好文 时间:
2014-08-04 10:52:07
阅读次数:
295
###-*-coding:cp936-*-###<ahref="http://home.51cto.com"target="_blank">家园</a>##importurllib##str0=‘<ahref="http://home.51cto.com"target="_blank">家园</a>‘##href=str0.find(‘<ahref‘)##printhref##com=str0.find(‘.com"‘)##printcom##ur..
分类:
Web程序 时间:
2014-08-04 08:21:17
阅读次数:
263
不相交集合 故名思意就是一种含有多个不相交集合的数据结构。典型的应用是确定无向图中连通子图的个数。其基本操作包括:Make-Set(x):建立一个新的集合,集合的成员是x;Union(x,y): 将包含x和y的集合合并为一个集合;Find-Set(x): 返回指向包含x的集合的指针;下面是一个例子,...
分类:
其他好文 时间:
2014-08-04 06:13:46
阅读次数:
218
题目:Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique lo....
分类:
编程语言 时间:
2014-08-04 04:10:26
阅读次数:
374
shell是个好东西,极大的方便了查询工作,之前遇到一个问题,查询包含有特定字段的特定文件,经过查询,命令如下:1 find . -type f -name '*.cpp' print|xargs grep -r '#include' -l 上述命令的意思是查询包含有 '#include' 字...
分类:
系统相关 时间:
2014-08-04 01:59:36
阅读次数:
230
题目:
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3....
分类:
其他好文 时间:
2014-08-03 23:29:46
阅读次数:
283
HDU 4002 Find the maximum(数论-欧拉函数)
题目大意:
给定一个n,问你1~n中,求一个数 x 使得 x/φ(x) 的值最大。
解题思路:
根据欧拉函数的公式,φ(x)=x(1-1/p1)(1-1/p2)(1-1/p3)(1-1/p4)…..(1-1/pn)
则:x/φ(x)=p1/(p1-1)*p2/(p2-1)*......*pn/(pn-1)
可以看出项越多x/φ(x)越大,且因子越小x/φ(x)越大,那么只需要2*3*5*7....
考虑到数字很大,所以用JAVA来写...
分类:
其他好文 时间:
2014-08-03 23:16:46
阅读次数:
268
题目连接:Sherlock and MiniMaxWatson gives Sherlock an arrayA1,A2...AN.He asks him to find an integerMbetweenPandQ(both inclusive), such that,min {|Ai-M|, ...
分类:
其他好文 时间:
2014-08-03 23:04:06
阅读次数:
380
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol...
分类:
其他好文 时间:
2014-08-03 22:59:56
阅读次数:
259