比起POJ弱爆了一题,从后往前扫描一遍,O(n)时间,只要注意各种极端情况即可,不明白通过率为什么只有13%。
#include
#include
using namespace std;
class Solution {
public:
void reverseWords(string &s) {
char* cstr = new char[s.size()+1];
...
分类:
其他好文 时间:
2014-06-05 03:45:47
阅读次数:
221
今天做作业连了一天的mysql。
最后我痛定思痛,决定从0开始学习jsp,省的又面临不会的局面。
忙活了一晚上,终于把数据库连接上了,不过,好伤心啊,我连个数据库都这么墨迹。。。
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServer...
分类:
数据库 时间:
2014-06-05 03:37:23
阅读次数:
244
有点意思的题目。用动态规划可以O(n)求解出来:a[i]代表子字符串string(0,i)的可能解码方式,a[i] = {a[i-1] or a[i-1]+a[i-2]}.
意思是如果string(i)不为0,至少a[i] == a[i-1],即一种解码方法是string{0,.....(i-1)}+string(i);
然后如果string{i-1,i}是合法的(注意合法概念,比如...
分类:
其他好文 时间:
2014-06-05 03:36:48
阅读次数:
231
在看这个例子之前,可以先看看:详解C和C++中的const和const和static变量的存放位置这样将会对const有非常全面的了解和认识:
下面我们将通过下面的例子看看const的一些非常不易发觉的错误:
#include
using namespace std;
class String
{
public:
friend ostream& operator<<(ostream& os...
分类:
其他好文 时间:
2014-06-05 02:53:26
阅读次数:
273
在构造体内初始化数据成员是最常见的方法。
例如:
#include
using namespace std;
class A
{
private:
int i;
string s;
public:
A(int ii,string ss){
//在构造函数体内初始化数据成员
i=ii;
s=ss;
cout<<"ctor:i="<<i<<",s="<<s<<endl;
...
分类:
编程语言 时间:
2014-06-05 01:00:02
阅读次数:
219
【题目】
Validate if a given string is numeric.
Some examples:
"0" => true
" 0.1 " => true
"abc" => false
"1 a" => false
"2e10" => true
Note: It is intended for the problem statement to be ambiguous. You should gather all requirements up front before imple...
分类:
其他好文 时间:
2014-06-04 23:45:09
阅读次数:
388
package com.beyole.util;
import java.awt.GraphicsEnvironment;
public class test3 {
public static void main(String[] args) {
GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment(...
分类:
编程语言 时间:
2014-06-04 23:29:02
阅读次数:
406
1、错误描述
五月 27, 2014 12:07:05 上午 freemarker.log.JDK14LoggerFactory$JDK14Logger error
严重: Template processing error: "Can't convert the date to string, because it is not known which parts of the date va...
分类:
其他好文 时间:
2014-06-04 22:00:07
阅读次数:
280
问题
输入:一个表示数字的字符串,需要考虑不同的输入形式。
输出:对应的整数
特殊输入形式:
1.输入开始几个字符为空格
2.考虑正负号
3.数字字符不属于[0,9]时,输出当前结果
4.字符串代表的数字大于INT_MAX或者小于INT_MIN时输出INT_MAX或者INT_MIN。
class Solution {
// out of range...
分类:
其他好文 时间:
2014-06-03 06:30:14
阅读次数:
314
错误1 ——
Caused by: android.content.res.Resources$NotFoundException:
String resource ID #0x0
错误原因——...
分类:
移动开发 时间:
2014-05-31 21:39:18
阅读次数:
642