给定一个字符串,问最少添加多少个字符可以使得这个字符串变成回文串if(str[i]==str[j]) dp[i][j] = dp[i+1][j-1]else dp[i][j] = min(dp[i][j-1],dp[i+1][j]);可以看出,dp[i][j] 要么是从dp[i+1][] 这个状态转...
分类:
其他好文 时间:
2015-09-05 11:13:54
阅读次数:
180
循环语句可以有一个else子句;当(for)循环迭代完整个列表或(while)循环条件变为假,而非由break语句终止时,就会执行这个else语句。下面循环搜索质数的代码例示了这一点:>>>>>> for n in range(2, 10):... for x in range(2, n):...
分类:
编程语言 时间:
2015-09-05 06:35:28
阅读次数:
179
一般我们开发阶段需要很多NSLog 但是在发布的时候我们就需要把NSLog干掉 为了方便我们使用下面判断语句我们开发阶段是DEBUG 上先处于Release#ifdef DEBUG // 处于开发阶段#define HWLog(...) NSLog(__VA_ARGS__)#else // 处于发....
分类:
其他好文 时间:
2015-09-04 22:28:32
阅读次数:
157
今天学习了scala的界定,先来看看下面这段代码//class Pair[T] (val first : T,val second : T)class Pair[T 0) first else second}class Pair_Lower_Bound[T](val first : T,val s....
分类:
其他好文 时间:
2015-09-04 18:35:13
阅读次数:
149
function getIframeDoc(id){ var doc; if (document.all){//IE doc = document.frames[id].document; }else{//Firefox doc = document.getElementById(id)....
分类:
其他好文 时间:
2015-09-04 17:05:29
阅读次数:
140
= 36){ $n = 36 + ceil(($n - 36) / 3) * 3; $captchaResult .= substr($captchaSource, $n, 3); }else{ $captchaResult .= substr($ca...
分类:
Web程序 时间:
2015-09-04 16:55:45
阅读次数:
161
实现://二叉树类
publicclassMyBiTree{
privateMyBiTreeNoderoot;//根节点
MyBiTree()
{
this.root=null;
}
MyBiTree(Objectdata,MyBiTreeleft,MyBiTreeright)
{
MyBiTreeNodel,r;
if(left==null)
{
l=null;
}
else
{
l=left.root;
}
..
分类:
其他好文 时间:
2015-09-04 14:27:34
阅读次数:
219
打印机连接向导,可自动识别是否是简体中文系统,然后选择提示语音。首先使用当前用户进行连接,如果不是内网用户则连接无法建立,那么就会使用打印机操作员帐户进行连接。@echo offver |findstr 版本if %errorlevel%==0 (GOTO CNStart) else GOTO EN...
分类:
其他好文 时间:
2015-09-04 12:34:17
阅读次数:
139
N(3 9 || n < 3) { System.out.println("0"); } else { int number = n; for (int i = n + 1; i < Integer.MAX_VALUE; i++) { if (!isOk(i, number)) ...
分类:
其他好文 时间:
2015-09-04 09:52:25
阅读次数:
164
代码如下:public int Sum_Solution(int n) { int temp = n; boolean b = (temp>0)&&(temp += Sum_Solution(n-1))>0; return temp; }
分类:
其他好文 时间:
2015-09-04 09:48:48
阅读次数:
119