一、匿名函数的创建 第一种:(调用sum后可执行) var sum=function(x,y){ return x+y; } 第二种:(可自执行) void function(x,y){ }(1,2); 自执行的匿名函数 1. 什么是自执行的匿名函数? 它是指形如这样的函数: (function { ...
分类:
Web程序 时间:
2016-10-04 13:50:46
阅读次数:
168
函数 调用 abs 即求绝对值 只有一个函数 比较函数 cmp(x,y) 有两个参数 x>y 1 x<y -1 x=y 0 数据类型转化 int() 定义函数 自定义求绝对值的my-abs函数 def my-abs(a): if a>=0: return a else: return -a def ...
分类:
编程语言 时间:
2016-10-04 11:57:35
阅读次数:
136
实验一: 代码: #include<stdio.h>int main(){ printf("*********\n *******\n *****\n ***\n *"); return 0;a} 2. 输入3个整数并且计算他们的和, 输入格式: 1 2 3 输出格式: 1+2+3=6 代码: #i ...
分类:
其他好文 时间:
2016-10-04 11:46:59
阅读次数:
183
34.SearchforaRangeGivenasortedarrayofintegers,findthestartingandendingpositionofagiventargetvalue.Youralgorithm‘sruntimecomplexitymustbeintheorderofO(logn).Ifthetargetisnotfoundinthearray,return[-1,-1].Forexample,Given[5,7,7,8,8,10]andtargetvalue8,return[3,..
分类:
其他好文 时间:
2016-10-04 08:02:21
阅读次数:
99
leetcode1.TwoSumGivenanarrayofintegers,returnindicesofthetwonumberssuchthattheyadduptoaspecifictarget.Youmayassumethateachinputwouldhaveexactlyonesolution.Example:Givennums=[2,7,11,15],target=9,
Becausenums[0]+nums[1]=2+7=9,
return[0,1].UPDATE(2016/2/13):Th..
分类:
其他好文 时间:
2016-10-04 07:49:47
阅读次数:
119
1. Excel Sheet Column Number Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding c ...
分类:
其他好文 时间:
2016-10-04 07:33:03
阅读次数:
168
DFS : depth first search BFS: breadth first search DFS : 46. Permutations Given a collection of distinct numbers, return all possible permutations. Fo ...
分类:
其他好文 时间:
2016-10-04 07:29:02
阅读次数:
192
实验一 #include<stdio.h> int main(){printf("*********\n *******\n *****\n ***\n *\n");return 0;} 实验二 #include<stdio.h>int main(){int a,b,c,sum;printf("请输 ...
分类:
其他好文 时间:
2016-10-03 21:37:23
阅读次数:
203
乘法逆元:若,则称为在意义下的乘法逆元. 本文介绍乘法逆元的三种求法. 扩展欧几里得求逆元 因为,所以设满足, 则可以用扩展欧几里得求关于的方程的一组解,即求出b. inline int exgcd(int a,int b,int &x,int &y){ if(!b){ x=1;y=0;return... ...
分类:
其他好文 时间:
2016-10-03 21:29:18
阅读次数:
223
pi = acos(-1);double getlen(int n,double r) { return 2.0*r*tan(pi/n);} ...
分类:
其他好文 时间:
2016-10-03 19:24:46
阅读次数:
151