Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3....
分类:
其他好文 时间:
2014-04-29 13:47:20
阅读次数:
251
本题可以使用长整形来记录数据的,因为最长不过10^8,但是如果把这题当做是无穷大数来做的话,难度指数就直线上升了。
这里给出使用string来做无穷大减法的解法。
要处理的问题:
1 string大小比较问题,不能使用原始的<号
2 如何进位的问题
3 符号问题,因为这里只求差异就可以了,所以返回绝对值就够了。
这样做本题还是有一定难度, 而且可以锻炼到一些高级点的知识的运用,挺好。...
分类:
其他好文 时间:
2014-04-29 13:46:22
阅读次数:
277
#include
#include
#include
#include
int main() {
int i,v;
char bs[33];
char b[33];
char hs[9];
char h[9];
char s[4];
char *e;
// 十进制整数转二进制串;
i=1024;
ltoa(i,b,2...
分类:
其他好文 时间:
2014-04-29 13:26:21
阅读次数:
485
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
void func()
{
string url;
cout << "输...
分类:
Web程序 时间:
2014-04-29 13:21:20
阅读次数:
506
在java所有类中都有一个共有的父类Object,一个类只要没有明显的继承一个类,则肯定是object类的子类
object类中有常用的四个方法。1、public object()构造方法
2、public boolean equals(object obj)对象比较 3、public int hashcode()取得hash码
4、public String toString();对象打...
分类:
其他好文 时间:
2014-04-29 13:17:21
阅读次数:
373
会话清除与过期
程序主动清除session数据
设置会话失效:session.invalidate()
移除会话中一个属性:
语法:public void removeAttribute(String name);
服务器主动清除长时间没有再次发出请求的session
设置会话过期时间
方法一:public void setMaxInactiveInterval(int interv...
分类:
编程语言 时间:
2014-04-28 10:36:41
阅读次数:
322
记录一下,自己用过的打开第三方应用的两种方法;
1.//根据包名类名启动第三方应用(要启动的应用的包名,要启动的activity)
openApp("com.xx.test", "com.xx.test.TestActivity");
private void openApp(String pname,String aname){
// changeInputSo...
分类:
其他好文 时间:
2014-04-28 10:25:41
阅读次数:
400
大数乘法的步骤(先戳我看看大数加法的思想):
首先我们输入要相乘的2个数字,然后逆序。用2层循环来相乘,把下标[i]*[j]计算的结果放在下标[i*j-1]中(下标从1开始),建议及时处理进位问题(char字符范围比较小)。
最后从高位开始输出。
#include
#include
#define MAX 1000
using namespace std;
void InputN...
分类:
其他好文 时间:
2014-04-28 10:24:42
阅读次数:
371
欢迎加入我们的QQ群,无论你是否工作,学生,只要有c / vc / c++ 编程经验,就来吧!158427611
所谓的unicode文件,无非就是在文件头部插入了 0xFFFE的标志。。。读写的时候对应的读写 就可以了。
namespace fileStream
{
bool readFile_Unicode( const string &file ,wstr...
分类:
编程语言 时间:
2014-04-28 10:22:41
阅读次数:
678
java的String是不可变类。为了提高效率,java为String类提供了String池。
当我们使用形如String s="abc"的代码为字符串赋值时,JVM首先会检查字符串常量池中是否有"abc"这个字符串,如果有就直接将其地址赋给s;若没有,则在Stirng池中创建一个字符串对象“abc”,再将其地址赋给s。...
分类:
编程语言 时间:
2014-04-27 22:48:10
阅读次数:
486