码迷,mamicode.com
首页 >  
搜索关键字:if then else    ( 23991个结果
Combination Sum 和Combination Sum II
这两道题的基本思路和combination那一题是一致的,也是分治的方法。其中combination Sum复杂一点,因为每个数可能用多次。仔细分析下,本质上也是一样的。原来是每个数仅两种可能。现在每个数有k +1中可能,k = target / i。所以就是把简单的if else 分支变成for循...
分类:其他好文   时间:2014-09-11 22:15:22    阅读次数:188
javascript回调函数
function $$(f) { if (typeof f == 'function') {//f是一个函数 f(); } else { alert('not a function'); } } ...
分类:编程语言   时间:2014-09-11 13:51:41    阅读次数:190
Ext.data.Store 中 data 的克隆原理
前端时间开发的时候,需要将Ext.data.Store中的data先储存到一个变量中,然后将把这个store的data清空,最后再把变量中的data load到store中。代码是这样的:var tempData = this.store.data.clone();/* Something else...
分类:其他好文   时间:2014-09-10 15:32:00    阅读次数:289
C语言中的调试宏
#ifdef DEBUG #define debug_printf(fmt, ...) printf(fmt, ##__VA_ARGS__) #else #define debug_printf(fmt, ...) #endif 其中##在没有参数的时候去掉前面的","号,否则在没有参数的时候,编译会报错。 #include #ifdef DEBUG #define debug_prin...
分类:编程语言   时间:2014-09-10 14:17:00    阅读次数:200
关于函数声明要注意的问题
1.先声明javascript函数再使用2.函数生命不应该出现在语句块内,例子如下:if (condition) { function doSomething() { alert(1); }} else { function doSomething() { ...
分类:其他好文   时间:2014-09-10 12:09:30    阅读次数:129
工作小总结(字符串包含,获取当前页面的url等系列问题)
1.字符串包含;var str="我爱中国";if(str.indexOf("中国")>=0){ alert("含有此字符串");}else{ alert("没有此字符串");}2.获取当前url问题;设置或获取对象指定的文件名或路径。window.location.pathname例:http.....
分类:其他好文   时间:2014-09-10 12:06:50    阅读次数:233
Python OS模块学习(二)
4.进程的相关处理system( )给当前进程输入系统shell命令import osif os.name == "nt": command = "dir"else: command = "ls -l" os.system(command) execvp 开始一个新进程, 以取代目前进程 impor...
分类:编程语言   时间:2014-09-10 10:46:00    阅读次数:190
去除Flexgrid表格的隔行底色为白的样式
简单,去除所有跟erow有关的代码即可else { if (i % 2 && p.striped) tr.className = 'erow';}if (p.striped) { $('tbody tr:odd', g.bDiv).addClass('erow');}
分类:其他好文   时间:2014-09-10 09:32:40    阅读次数:176
取子集
#include #include #include using namespace std; void print(int n) { for(int i=0;(1<<i)<=n;i++) if(n&(1<<i)) cout<<1; else cout<<0; cout<<endl; } int main() { i...
分类:其他好文   时间:2014-09-09 16:03:59    阅读次数:220
php 字符串负值判断
2014年9月9日 11:54:54 1 $a = '-1'; 2 $b = (int)$a; 3 $c = is_numeric($a); 4 if ($a) { 5 echo 1; //echo 1 6 } else { 7 echo 2; 8 } 9 var_dump($b);...
分类:Web程序   时间:2014-09-09 15:22:18    阅读次数:151
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!