分析:暴力要超时,所以把每个数字转换为长度为32的0-1字符串,用字典树。因为其公共前缀的特性,空间上可以承受。因为是二叉树,用node[SIZE][2]存放。不知道new速度是否会慢很多,所以没用指针。...
分类:
其他好文 时间:
2014-05-18 18:37:37
阅读次数:
218
一个简单的去除字符串中字符重复,并排序的算法...
分类:
其他好文 时间:
2014-05-18 18:24:36
阅读次数:
221
例如:有表1,表2两张相,希望通过like进行关联查询
// mysql中使用concat连接字符串
select t1.id, t1.title, t2.keyword from t1 inner join t2 on t1.title like concat('%', t2.keyword, '%');
// oracle、postgres 使用||连接字符串,其它库使用...
分类:
其他好文 时间:
2014-05-18 15:57:36
阅读次数:
242
19.String类:
1>String类的构造方法:
· 利用字符串构造一个字符串对象:
String str = “HelloWorld”;
2>字符串对象操作:
· charAt() :返回的是index+1位置的字符。
· equals和equalsIgnoreCase方法:...
分类:
编程语言 时间:
2014-05-18 15:30:44
阅读次数:
372
//普通方法
void strcpy1(char str1[], char str2[]){
int i = 0;
for (; str2[i] != '\0'; i++){
str1[i] = str2[i];
}
str1[i] = '\0';
}
//简练方法
void strcpy2(char str1[], char str2[]){
int i = 0;
whil...
分类:
其他好文 时间:
2014-05-18 09:47:40
阅读次数:
273
18. 字符串、包装类、原始数据类剪得转换:
各个转换如下:
1>String 转换成Integer:
Integer integer = new Integer(“string”);或
Integer Integer = Integer.valueOf(String);
注:String必须是数字字符串,如:”1232“。
2>Integer 转换成String:...
分类:
编程语言 时间:
2014-05-18 07:40:29
阅读次数:
240
1001
1002
1003
这题错了半天 伤不起 转成字符串搞字典树就错 最后直接位运算&建树就对了
AC代码
#include
#include
typedef __int64 LL;
const int maxn = 100010;
const int maxnode = 60000000;
const int sigma_size = 2;
LL a[maxn];
char...
分类:
其他好文 时间:
2014-05-18 04:47:04
阅读次数:
310
【题目】
Implement strStr().
Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.
【题意】
实现库函数strStr(), 功能是在字符串haystack中找出目标串needle第一次出现的索引位
【思路】
字符串的匹配,可以用暴力解法,但不推荐。一般使用KMP算法求解。
简要介绍一下KMP的思想:
...
分类:
其他好文 时间:
2014-05-18 04:10:04
阅读次数:
244
分享了以下tips:
一、事务管理
二、xml配置sql代码段
三、#和$的区别
四、注意对做转义
五、依据字符串是否为空,动态组织sql语句
六、使用自定义的类型转换器
七、resultMap的复用
一、事务管理
用户执行一个动作,后台需依次更新多个表,如果其中有一个更新失败,则要回滚之前的更新。这种情况,就是事务回滚。
要支持事务操作,需要:
...
分类:
其他好文 时间:
2014-05-18 04:05:57
阅读次数:
291