scala混合了面向对象和函数式的特征。在函数式的编程语言中,函数是可以像其他的数据类型一样被传递和操作。这对于想将详细动作传入给算法时变得非常有用。importscala.math._
valfun=ceil_/从技术上将_的作用是将ceil方法变成了函数
res=fun(num)/num=3.14,res=4
Array(3.14,..
分类:
其他好文 时间:
2014-09-18 16:45:25
阅读次数:
188
http://acm.hdu.edu.cn/showproblem.php?pid=1342
题意:以升序的形式给定k个数,输出从中挑选6个数满足升序的所有情况。
思路:两个参数,第一个保存当前搜索的位置,第二个保存个数。
#include
#include
int a[15],b[15],vis[15],k;
void dfs(int ans,int num)
{
if(num==...
分类:
其他好文 时间:
2014-09-18 16:38:24
阅读次数:
186
"SELECT 1 FROM identity_approve WHERE identity_num=' " . trim($_POST['IDnumber']) . " ' AND user_id !=".trim($_POST['uid']); 到底会有什么输出? select 1 fro...
分类:
其他好文 时间:
2014-09-18 16:22:24
阅读次数:
135
Synchronized,volatile,lock
锁->[就绪队列,堵塞队列]
第一个是jvm层次实现的。与volatile不同的是,后者不能从工作内存写回到主存。所以后者常用于类变量的同步
lock来说,在竞争资源激烈的情况下,效率最高。...
分类:
编程语言 时间:
2014-09-18 14:52:41
阅读次数:
183
public void WriteLog(string logStr) { lock (this) { string path = @"D:\log\payment\"; string file = DateTim...
分类:
其他好文 时间:
2014-09-18 12:45:43
阅读次数:
1756
1.题目描述487-3279Time Limit: 2000MSMemory Limit: 65536KTotal Submissions: 244177Accepted: 43308DescriptionBusinesses like to have memorable telephone num...
分类:
其他好文 时间:
2014-09-18 03:05:23
阅读次数:
225
A method and apparatus for executing lock instructions speculatively in an out-of-order processor are disclosed. In one embodiment, a prediction is ma...
分类:
移动开发 时间:
2014-09-18 01:57:13
阅读次数:
283
A turn-oriented thread and/or process synchronization facility obtains a ticket value from a monotonically increasing ticket counter and waits until a...
分类:
其他好文 时间:
2014-09-18 00:32:33
阅读次数:
343
#!/bin/bash
if[$#-eq0];then
echo"输入值不能为空"//提示不能输入空值注:$#代表环境变量个数
exit
fi
num=$*//定义一个全局变量,方便后边的调用
sum(){
sum=0
while[$#-gt0]
do
sum=$[$sum+$1]
shift
done
echo"数字$num相加的和是$sum"
}
cha(){
cha=$1
shift
while[$#-..
分类:
其他好文 时间:
2014-09-17 18:52:42
阅读次数:
263
大家都知道js中变量的声明是要提前的,以下有4个例子:
1.if(!"t" in window){
var t = 1;
}
alert(t);答案是undefined,为什么呢,就是因为变量声明提前了,所以t是在window对象里面的,但是没有走下面的判断,所以并没有赋值,答案就是undefine
2.var num = 100;
function fn(...
分类:
Web程序 时间:
2014-09-17 18:46:22
阅读次数:
214