AtomicInteger,一个提供原子操作的Integer的类。在Java语言中,++i和i++操作并不是线程安全的,在使用的时候,不可避免的会用到synchronized关键字。而AtomicInteger则通过一种线程安全的加减操作接口。来看AtomicInteger提供的接口。//获取当前的...
分类:
其他好文 时间:
2014-06-26 18:18:11
阅读次数:
272
Divide two integers without using multiplication, division and mod operator.
思路:1.先将被除数和除数转化为long的非负数,注意一定要为long,因为Integer.MIN_VALUE的绝对值超出了Integer的范围。
2.常理:任何正整数num都可以表示为num=2^a+2^b+2^c+.....
分类:
其他好文 时间:
2014-06-25 19:46:17
阅读次数:
246
简析SynchronousQueue,LinkedBlockingQueue,ArrayBlockingQueue
三者都是blockingQueue.
LinkedBlockingQueue,ArrayBlockingQueue
有界,默认是Integer.Max;
SynchronousQueue没什么界不界的概念.之所以这么...
分类:
其他好文 时间:
2014-06-25 19:19:39
阅读次数:
397
11.1这道题要注意使用了line strip,由于曾经一直用triangle list,所以在几何渲染的时候easy算错定点描绘的顺序。贴一些代码,大概就能把这个问题解释清楚了,由于框架还不是特别熟,所以是在原有样例的基础上建立的自己的代码void TreeBillboardApp::BuildC...
分类:
其他好文 时间:
2014-06-25 17:11:30
阅读次数:
462
Java中的基本数据类型分四类八种byte(Byte-1)/short(Short-2)/int(Integer-4)/long(Long-8)boolean(Boolean-1bit)char(Character-2)float(Float-4)/double(Double-8)括号后是他们的包装...
分类:
编程语言 时间:
2014-06-25 11:31:46
阅读次数:
234
题目链接:uva 10843 - Anne's game
题目大意:给出n,问说有n个节点构成的标号树有多少种。
解题思路:cayley定理的躶题。
#include
#include
typedef long long ll;
const ll MOD = 2000000011;
ll Pow (ll x, ll n) {
if (n 0)
ret...
分类:
其他好文 时间:
2014-06-24 23:46:31
阅读次数:
239
【问题】
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /.
Each operand may be an integer or another expression.
Some examples:
...
分类:
编程语言 时间:
2014-06-24 23:22:53
阅读次数:
331
题目
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possibl...
分类:
其他好文 时间:
2014-06-24 23:14:28
阅读次数:
238
题目
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
Have you thought about this?
Here are some good questions to ask before coding. Bonus poin...
分类:
其他好文 时间:
2014-06-24 20:16:39
阅读次数:
180
check_disk命令用法:check_disk-wlimit-climit[-Wlimit][-Klimit]{-ppath|-xdevice}
[-C][-E][-e][-ggroup][-k][-l][-M][-m][-Rpath][-rpath]
[-ttimeout][-uunit][-v][-Xtype]选项:-h,--help
-V,--version
-w,--warning=INTEGER
如果磁盘空闲容量小于INTEGER单位时、ExitwithW..
分类:
其他好文 时间:
2014-06-24 16:34:34
阅读次数:
710