一、ANSI转换为UTF-16#include wchar_t* AnsiToUnicodeBegin(const char* str){ char* sz = new char[strlen(str)+1]; strcpy(sz, str); int wLen = MultiByteT...
最长公共子序列LCS有模板的吧#include#include#includeusing namespace std;int i,j,dp[1000][1000],len1,len2;char a[1000],b[1000];void LCS(){ memset(dp,0,sizeof(dp)...
分类:
其他好文 时间:
2014-09-10 22:18:01
阅读次数:
167
"'itoa' was not declared in this scope" 错误本文地址: http://blog.csdn.net/caroline_wendyitoa函数不是ANSI(American National Standards Institute) C的标准, 应该避免使用这个函数.简易替代版本为://itoa(i, s, 10);
snprintf(s, sizeof(s),...
分类:
编程语言 时间:
2014-09-10 17:45:26
阅读次数:
959
1 #include 2 #include 3 #include 4 5 int getArray(int ***p,int m,int n)//构造一个m*n维数组,并清零 6 { 7 int i; 8 *p=(int **)malloc(sizeof(int*)*m);...
分类:
编程语言 时间:
2014-09-10 17:23:00
阅读次数:
229
$str = "中华人民共和国"; $len = mb_strlen($str,'utf-8'); if($len>=6){ $str1 = mb_substr($str,0,2,'utf-8'); $str2 ...
分类:
Web程序 时间:
2014-09-10 01:34:49
阅读次数:
2924
题意:给定两个串,求出两个串的最长公共子序列,要求该公共子序列不包含virus串。用dp+kmp实现dp[i][j][k]表示以i结尾的字符串和以j结尾的字符串的公共子序列的长度(其中k表示该公共子序列的与virus的匹配程度)很显然,当k==strlen(virus)时,该公共子序列不是我们所求得...
分类:
其他好文 时间:
2014-09-09 20:03:59
阅读次数:
207
#include #include #include #include using namespace std;int main(){ char s[1000]; char t[1000]; int len; int i, j; memset(s, '\0', sizeof(s)); m...
分类:
其他好文 时间:
2014-09-09 20:01:39
阅读次数:
203
Const在建立它的地方被初始化。Const修饰无法修改。
关于static const类型是:所有的对象共享且不变的数据。
http://blog.csdn.net/luoweifu/article/details/20288549
输出本地时间:
time_t t = time(0);
char tmp[64];
strftime( tmp, sizeof(tm...
分类:
编程语言 时间:
2014-09-09 13:18:58
阅读次数:
231
#include #include #include void GetNext(int *next, char *str){ int len = strlen(str); int i, k, flag = 1; next[0] = -1; for(i = 2; i < len; i++) //nex...
分类:
其他好文 时间:
2014-09-09 11:02:28
阅读次数:
184
strlen: 1 #ifndef STRLEN_H 2 #define STRLEN_H 3 4 #include 5 6 // 参考微软的写法 7 int cat_strlen(const char *str) { 8 const char *p = str; 9 10 ...
分类:
编程语言 时间:
2014-09-09 10:34:18
阅读次数:
180