1、sleep()使当前线程(即调用该方法的线程)暂停执行一段时间,让其他线程有机会继续执行,但它并不释放对象锁。也就是说如果有synchronized同步快,其他线程仍然不能访问共享数据。注意该方法要捕捉异常。例如有两个线程同时执行(没有synchronized)一个线程优先级为MAX_PRIOR...
分类:
编程语言 时间:
2014-06-21 08:30:15
阅读次数:
285
1 --逻辑表达式 2 3 --1+2+3+...+n 4 function fun1(n) 5 local sum = 0 6 for i=1,n do 7 sum = sum + i 8 end 9 return sum 10...
分类:
其他好文 时间:
2014-06-21 08:04:22
阅读次数:
292
如果考虑hashmap直接O(n)的速度, 如果不行,就先排序,两头指针很好推理,关键是 a[beg] +a[end]>sum,意思就是说a[end]太大了,最小的数的都不满足,所以排除a[end] 绝知此事要躬行 #include#includeusing namespace std; bool ...
分类:
其他好文 时间:
2014-06-21 07:38:14
阅读次数:
187
经典搜索 1 #include 2 #include 3 using namespace std; 4 5 const int MAX=10; 6 7 int step[MAX][MAX]; 8 char maze[MAX][MAX]; 9 int n,m,t;10 struct {11 ...
分类:
其他好文 时间:
2014-06-21 07:12:00
阅读次数:
218
Triangle: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, give...
分类:
其他好文 时间:
2014-06-21 07:02:07
阅读次数:
203
简单题 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int MAX=205; 7 const int inf=1000000; 8 int tim[MAX][MAX]; 9 char maze[MAX][...
分类:
其他好文 时间:
2014-06-21 00:34:49
阅读次数:
226
基础数据结构: struct A { int a; int b; int c; int d; int e; int f; int g; };初始化次数:const int MAX_L...
分类:
其他好文 时间:
2014-06-21 00:17:14
阅读次数:
166
1 #include 2 #include 3 using namespace std; 4 5 const int MAX=105; 6 7 bool vis[MAX][MAX]; 8 char maze[MAX][MAX]; 9 int n,m;10 int dir[8][2]={0,...
分类:
其他好文 时间:
2014-06-21 00:14:01
阅读次数:
275
>_____<:头文件参见:http://www.cnblogs.com/zjutlitao/p/3733164.html 1 #include "stdafx.h" 2 #include "resourse.h" 3 4 #define MAX_LOADSTRING 100 5 6...
1 #include 2 #include 3 using namespace std; 4 5 const int MAX=13; 6 7 char maze[MAX][MAX][MAX]; 8 9 struct {10 int i,j,k;11 }beg,des,que[11...
分类:
其他好文 时间:
2014-06-20 14:04:37
阅读次数:
141