字符串的特性:不可变性,每对字符串做拼接或者重新赋值之类的操作,都会在内存中产生一个新的实例。所以说,在.Net平台下,如果你对一个字符串进行大量的拼接赋值等操作,会产生大量的垃圾。---->我们可以将字符串看做是char类型的只读数组。 --->当我们以索引的方式去访问某一个字符串的时候,获得是c...
文件写入//文件写入的位置为./data/data/包名/files/文件名public void fileW(String message) { try { FileOutputStream fout = MainActivity.this.openFi...
分类:
移动开发 时间:
2015-05-06 13:04:54
阅读次数:
195
Array类可以如下定义: var aValues = new Array(); 如果预先知道数组的长度,可以用参数传递长度 var aValues = new Array(20); ------------------如下2种定义方式是一样的--------1----------- ...
分类:
编程语言 时间:
2015-05-06 12:38:17
阅读次数:
142
给定一个序列,以最小代价将其变成单调不增或单调不减序列,这里的代价看题目公式
DP方程:dp[i][j]=abs(a[i]-b[j])+min(dp[i-1][k]);(k
详细题解:http://blog.csdn.net/wuyanyi/article/details/7255154
#include "stdio.h"
#include "string.h"
#...
分类:
其他好文 时间:
2015-05-06 11:04:45
阅读次数:
112
#include
#include
int main()
{
std::string str, str_long;
std::cin>>str_long;
while(std::cin>>str)
str_long = str_long + ' ' + str;
std::cout << str_long << std::endl;
r...
分类:
编程语言 时间:
2015-05-06 11:04:41
阅读次数:
162
用js显示今天的时间,年月日,包括星期几
* 对Date的扩展,将 Date 转化为指定格式的String
* 月(M)、日(d)、12小时(h)、24小时(H)、分(m)、秒(s)、周(E)、季度(q) 可以用 1-2 个占位符
* 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)...
分类:
Web程序 时间:
2015-05-06 11:03:34
阅读次数:
155
#include
#include
#include
int main()
{
std::string str, result_str;
bool flag=false;
while(getline(std::cin, str))
{
for(unsigned index=0; index<str.size(); ++index)
...
分类:
编程语言 时间:
2015-05-06 11:02:08
阅读次数:
159
这个题目leetcode上提示用动态规划,但是那样要O(n^2)。我自己想出了一个O(n)的算法,并提交通过。【题目】Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
For "((...
分类:
编程语言 时间:
2015-05-06 11:00:58
阅读次数:
123
在url地址栏使用中文传参数可能会是乱码了,下面我们来看看正确的jsp中页面间传中文参数转码的方法.转码代码:String tcontent = "测试";a.href="./showCont.jsp?tcontent="+encodeURI(encodeURI(tcontent));解码代码:j....
分类:
Web程序 时间:
2015-05-06 10:53:39
阅读次数:
145
题目:Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".代码:class Solution {public: string addBina...
分类:
其他好文 时间:
2015-05-06 10:53:29
阅读次数:
107