/*看一下部分的HashSet源码....public class HashSet extends AbstractSet implements Set, Cloneable, java.io.Serializable{ static final long serialVersio...
分类:
其他好文 时间:
2014-07-07 15:23:29
阅读次数:
253
int s = 5;int? s_null;long t;long? t_null;t = s; //隐式转换 S -> Ts = (int)t; //显示转换 T -> Ss_null = s; //隐式转换 S -> S?s = (int)s_null; //显示转换 S? -> Tt_null...
分类:
其他好文 时间:
2014-07-02 00:29:58
阅读次数:
287
1、设置一个守护线程对执行业务的线程计时,超时则抛出异常2、Thread类有一个join(long millis)方法,执行该方法时如果另一个线程中断了当前线程,就会抛出一个InterruptedException异常(超时也抛出)。3、java.util.concurrent包FutureTask...
分类:
编程语言 时间:
2014-07-01 23:43:37
阅读次数:
313
今天突然遇到了SharedPreferences问题,虽然以前用过,但从没有深入的了解一下,今天就顺便深入了解一下,并总结一下,防止以后忘记。SharePreferences是Android平台上一个轻量级的存储类,特别适合用于保存软件配置参数。比如boolean,float,long ,int,S...
分类:
移动开发 时间:
2014-07-01 13:22:57
阅读次数:
246
#include#include#include#includeusing namespace std;typedef long long ll;ll n,p;ll k;#define N 4000000ll a[N],fr[N];struct sq{ ll a[3][3]; sq(){...
分类:
其他好文 时间:
2014-07-01 00:44:52
阅读次数:
308
题意:在n*m的方格里有t个棋子,问最多能放多少个炮且每个炮不能互相攻击(炮吃炮)
炮吃炮:在同一行或同一列且中间有一颗棋子。
#include
#include
#include
#include
#include
#include
#define M 50
#define LL long long
using namespa...
分类:
其他好文 时间:
2014-06-30 19:31:26
阅读次数:
211
本文分析的是llvm libc++的实现:http://libcxx.llvm.org/
class thread
thread类直接包装了一个pthread_t,在linux下实际是unsigned long int。
class thread
{
pthread_t __t_; id get_id() const _NOEXCEPT {return __t_;}
}
...
分类:
编程语言 时间:
2014-06-30 19:29:24
阅读次数:
257
题意:有两堆n张的卡片,每张卡片有一个得分,Alice和Bob轮流在两堆卡片的两端取卡片
问Alice先手,取得分数最多为多少;
#include
#include
#include
#include
#include
#include
#define M 50
#define LL long long
using namespace ...
分类:
其他好文 时间:
2014-06-30 17:39:36
阅读次数:
258
题目链接:http://poj.org/problem?id=2299
题目大意:求出排序过程中的最小交换次数
利用归并排序的分治算法解决此题。
代码:
#include
#include
#include
#define N 500001
using namespace std;
int a[N];
int temp[N];
long long ans;
void merge(in...
分类:
其他好文 时间:
2014-06-30 08:18:11
阅读次数:
230
java中的4种整数类型:byte,short,int,long均采用补码表示。
如下图右边所示
在java中对二进制数没有“字面”表示方法。十六进制可以用OX或者Ox指示,八进制可以用O指示。
下面的代码可以输出byte类型的数据的2进制表示形式:
public class Test {
public static void main(String[] args...
分类:
编程语言 时间:
2014-06-29 23:24:27
阅读次数:
288