题意:
给你ABCD四个集合,集合中数的个数都为N(N
当然你可以尝试枚举所有的组合,绝对可以计算出结果,大概有N^4种吧,如果你有足够的时间还是可以算出来的,哈哈。
当然我不是用上面一种方法计算的,那样算肯定超时。 我的做法是求出所有a+b 到ab数组中, 和所有 c+d到cd数组中,然后排序,枚举每个ab,用二分在cd中查找有没有可能组成0。 有个问题就...
分类:
其他好文 时间:
2014-05-10 08:40:14
阅读次数:
278
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
public class ListFile {
public void listJavaFil...
分类:
编程语言 时间:
2014-05-07 06:31:39
阅读次数:
377
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the sequence of gr...
分类:
其他好文 时间:
2014-05-07 06:10:17
阅读次数:
370
private static void sort1(int x[], int off, int len) {
// Insertion sort on smallest arrays //长度小于7,采用冒泡排序
if (len < 7) {
for (int i=off; ioff && x[j-1]>x[j];...
分类:
其他好文 时间:
2014-05-07 05:14:35
阅读次数:
279
【题目】
Chapter 1 | Arrays and Strings
原文:
1.1 Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?
译文:
实现一个算法来判断一个字符串中的字符...
分类:
其他好文 时间:
2014-05-07 04:27:41
阅读次数:
312
CareerCup
目录
Chapter 1 | Arrays and Strings
1.1 Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?
1.2 Write co...
分类:
其他好文 时间:
2014-05-07 04:25:44
阅读次数:
320
题目
Given a binary tree, return the preorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,2,3].
Note: Recursiv...
分类:
其他好文 时间:
2014-05-07 03:30:19
阅读次数:
254
这几天搞了一下Oracle数据库,可能用sql server习惯了,感觉好不方便。PL的界面友好度比sql server差远了 ,既然都收购了PL了
为什么不给它做好一点呢?各种不便。郁闷
向Oracle服务器插入一条数据
--不管什么格式通通用''引号引起来。不过INTEGER格式的还是别用引号
insert into T_SITE VALUES(
8, --注意主键别与表里的其他主键冲...
分类:
数据库 时间:
2014-05-07 03:24:59
阅读次数:
319
如果读到的是音频文件路径,需要先将音乐文件插入到多媒体库。如:path传入:/mnt/sdcard/mp3/a.mp3
//设置--铃声的具体方法 public void setMyRingtone(String path) { File sdfile = new File(path); ContentValues values = new Co...
分类:
移动开发 时间:
2014-05-06 22:55:52
阅读次数:
500
题目原文:
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,Given n = 3, there are a total of 5 unique BST's.
题目理解...
分类:
其他好文 时间:
2014-05-06 22:15:57
阅读次数:
415