BOM头是UTF-8来告诉编辑器:我是UTF8编码。它的编码是\xEF\xBB\xBF但是PHP在设计之初并没有考虑到BOM头的问题,所以在编解码的时候很容易出现问题比如今天遇到的问题,json_decode,当解码的string有BOM头的时候json_decode就解析失败,返回NULL。(为什...
分类:
Web程序 时间:
2015-03-28 20:14:47
阅读次数:
157
Decode Ways
A message containing letters from A-Z is being encoded to numbers using the
following mapping:
'A' -> 1
'B' -> 2
...
'Z' -> 26
Given an encoded message containing d...
分类:
其他好文 时间:
2015-03-28 15:50:44
阅读次数:
108
给一字符串如a2bc3d1 转换成aabcbcbcd 1 String decode(String str) { 2 String word=""; 3 StringBuilder result=new StringBuilder(""); 4 f...
分类:
其他好文 时间:
2015-03-22 00:20:11
阅读次数:
154
今天在做微信接口的时候 ?发现json格式为null 之后改成这样子就可以了 private?function?parseJSON($string)?{
return?json_decode?(?$string,?true?);//不加true为对象?加了true为数组
}...
分类:
微信 时间:
2015-03-21 17:15:41
阅读次数:
274
题意:输入一组数,将其割成三段,每一段的值相同
解法:因为要割三组值相同,所以每一组的值一定是整体求和的1/3
千万记得long long,血的代价
#include
#include
long long num[500005];
int main()
{
int n;
long long a;
int i,j;
long long all;
wh...
分类:
其他好文 时间:
2015-03-21 17:10:54
阅读次数:
296
题目链接:Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
这道题的要求是爬n阶...
分类:
其他好文 时间:
2015-03-20 00:07:14
阅读次数:
110
There are several ways to present the output of a program; data can be printed in a human-readable form, or written to a file for future use. This cha...
分类:
编程语言 时间:
2015-03-19 23:28:10
阅读次数:
317
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you cli...
分类:
其他好文 时间:
2015-03-19 21:36:08
阅读次数:
111
Simple DP.Scanning from the end. If current is 0, then no ways as "0", but it can be treated as "10", "20". So do another check whether it can has oth...
分类:
其他好文 时间:
2015-03-19 07:45:43
阅读次数:
148
There are a number of ways to implement Ajax and Comet, and these underlying implementationsare sometimes known as transports.有很多方法可以实现ajax和comet,这些底层...
分类:
Web程序 时间:
2015-03-18 15:47:06
阅读次数:
140