之前写过一篇Json的博客,当时用的是Gson包来解析的,这次来此自带的org.json来解析。传送门:《Gson解析复杂Json数据》JSON的结构 (1) Name/Value Pairs(无序的):类似所熟知的Keyed list、 Hash table、Disctionary和Associa...
分类:
移动开发 时间:
2014-08-25 13:08:24
阅读次数:
316
递归打印lua中的table,并写到文件里: 1 local pairs_by_keys = function(inTable) 2 local temp = {} 3 for k, v in pairs(inTable) do 4 temp[#temp + ...
分类:
其他好文 时间:
2014-08-23 20:14:11
阅读次数:
218
Tigase数据库有很多张表,其中最主要的是3张表:tig_users,tig_nodes和tig_pairs。1.tig_userstig_users存储用户信息,有uid(主键,用户ID),user_id(用户名),usr_pw(用户密码)等字段。2.tig_nodestig_nodes是存储节...
分类:
数据库 时间:
2014-08-22 14:25:48
阅读次数:
401
Implement an algorithm to print all valid combinations of n-pairs of parentheses#includevoid f(int idx,int left,int right,char *buf){ if(left == 0 ...
分类:
其他好文 时间:
2014-08-21 13:06:34
阅读次数:
168
UVA 12338 - Anti-Rhyme Pairs
题目链接
题意:给定一些字符串,每次询问求出两个字符串的最长公共前缀的长度
思路:把字符串排序,就能求出height和rank数组,然后利用RMQ查询即可
代码:
#include
#include
#include
#include
#include
using namespace std;
co...
分类:
其他好文 时间:
2014-08-20 01:24:35
阅读次数:
300
题目:Given an integer N, and how many pairs (A;B) are there such that: gcd(A;B) = A xor B where 1=2)是不同位数的。和同学讨论后得出如下证明:设最大公约数为 j, 假设这两个数是b 和 b+k*j,(k>....
分类:
其他好文 时间:
2014-08-19 23:50:55
阅读次数:
233
A pair of numbers has a unique LCM but a single number can be the
LCM of more than one possible pairs. Forexample 12 is the
LCM of (1, 12), (2, 12),
(3,4) etc. For a given positive integer N, the ...
分类:
其他好文 时间:
2014-08-18 16:25:24
阅读次数:
240
题目链接:Pairs完全就是Two Sum问题的变形!Two Sum问题是要求数组中和正好等于K的两个数,这个是求数组中两个数的差正好等于K的两个数。总结其实就是“骑驴找马”的问题:即当前遍历ar[i],那么只要看数组中是否存在ar[i]+K或者ar[i]-K就可以了,还是用HashMap在O(1)...
分类:
其他好文 时间:
2014-08-15 17:17:19
阅读次数:
123
There areNintegers in an arrayA. All but one integer occur in pairs. Your task is to find out the number that occurs only once.Input FormatThe first l...
分类:
其他好文 时间:
2014-08-14 13:55:18
阅读次数:
242
Description
D
Anti-Rhyme Pairs
Input: Standard Input
Output: Standard Output
Often two words that rhyme also end in the same sequence of characters. We use...
分类:
其他好文 时间:
2014-08-13 18:45:37
阅读次数:
230