The first solution I figured out is O(n^3). I thought it must be O(n^2) to get max points on a line for a given point.. but after checking several art...
分类:
其他好文 时间:
2014-07-22 22:47:15
阅读次数:
226
Sorting It All Out
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 26911
Accepted: 9285
Description
An ascending sorted sequence of distinct values is one ...
分类:
其他好文 时间:
2014-07-22 22:38:36
阅读次数:
166
可动态增减的线程池,主线程accept——基于UNP代码修改1.说明线程池基于一个区间动态变化,在客户连接过多线程不够用时,动态增加一定数量的线程。在线程闲置数量多于一半时,动态减小线程数量到一个基准线。这个例子模式为:半同步/半异步(half-sync/half-async)2.代码相关说明代码基...
分类:
编程语言 时间:
2014-07-22 00:11:35
阅读次数:
387
二、工厂方法模式
1.动物管理系统的例子
首先,抽象的动物类和具体的动物实现类:
public interface Animal{
public void eat();
}
public class Tiger implements Animal
{
public void eat(){
sysout.out.println("老虎会吃");
};
...
分类:
其他好文 时间:
2014-07-22 00:07:33
阅读次数:
231
酷我音乐ios版下载的音乐文件,通过同步助手等软件查看时,发现音乐文件都是一串数字命名。通过网上查找和自己尝试,发现那些文件都是音频文件改了文件名而已。只要修改回文件名,就能和正常的音乐一样播放了。
在网上找到了一个软件,也就是上面参考网址中的软件,但是使用的时候出现了问题,提示subscript out of range,程序不能继续执行。于是就决定自己用Java写一个来处理。
首先从手机复制出cloud.db数据库文件,为SQLite数据库文件。用SQLite Database Browser打开,...
分类:
移动开发 时间:
2014-07-22 00:02:33
阅读次数:
395
staic变量是怎么样执行的? public class Client { public static int i = 0; static { ? i = 100; } public static void main(String[] args) { ? System.out.println(i); } } 这段程序很简单,输出100,那么...
分类:
编程语言 时间:
2014-07-21 23:30:21
阅读次数:
309
private static void prime(int i){
int j = 2;
while(true){
while(i%j == 0 && i != j){
System.out.println("Prime num " + j);
i = i/j;
}
if(i == j){
...
分类:
其他好文 时间:
2014-07-21 23:30:20
阅读次数:
426
UVA 1560 - Extended Lights Out
题目链接
题意:给定一个矩阵,1代表开着灯,0代表关灯,没按一个开关,周围4个位置都会变化,问一个按的方法使得所有灯都变暗
思路:两种做法:
1、枚举递推
这个比较简单,就枚举第一行,然后递推过去,每次如果上一行是亮灯,则下一行开关必须按下去
2、高斯消元,
这个做法比较屌一些,每个位置对应上下左右中5个位...
分类:
其他好文 时间:
2014-07-21 23:30:00
阅读次数:
244
//十进制的数转化为二进制 public static void toBin(int num){ if(num > 0){ toBin(num/2); System.out.println(num%2); } } 以上面的十进制转化为二进制为例:传参数传入6,把6转化为二进制:使用递归...
分类:
其他好文 时间:
2014-07-21 23:29:01
阅读次数:
225
Description
The multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and scores the number of points ...
分类:
其他好文 时间:
2014-07-21 22:11:18
阅读次数:
289