/*
Easier Done Than Said?
Problem DescriptionPassword security is a tricky thing. Users prefer simple passwords
that are easy to remember (like buddy), but such passwords are often insecure. Some...
分类:
其他好文 时间:
2014-07-29 14:40:28
阅读次数:
288
/*
Easier Done Than Said?
Problem DescriptionPassword security is a tricky thing. Users prefer simple passwords
that are easy to remember (like buddy), but such passwords are often insecure. Some...
分类:
其他好文 时间:
2014-07-29 14:39:48
阅读次数:
302
1. length() size()都是表示 字符串 中的元素数, 等于begin()到end()之间的距离.length()是考虑到传统C函数 strlen而对应设置的,而size()是考虑到string作为一个STL容器2. length() sizeof()sizeof可以计算一个 类型 .....
分类:
其他好文 时间:
2014-07-29 14:03:18
阅读次数:
231
1、strlen()获得一个字符串的长度。
2、strstr()获取一个字符串的子串,也可以用来判断一个字符串是否存在于另一个子字符串中。这个函数不区分大小写。
3、strpos()找到一个子字符串的位置。
4、substr()提取一个字符串的一部分。区分大小写。
substr($test,3);//指向位置3以后的全部子字符串
substr($test,3,2)...
分类:
Web程序 时间:
2014-07-29 13:17:16
阅读次数:
280
贪心
#include
using namespace std;
int main()
{
long long n;
char s[100020];
while(scanf("%I64d",&n)==1)
{
scanf("%s",s);
int len=strlen(s);
long long sum1=0,sum...
分类:
其他好文 时间:
2014-07-29 13:07:36
阅读次数:
192
在C语言中,没有类似Java的String类对字符串的处理,字符串的包装可以采用字符数组。先看字符数组:#includevoid main() { char array[] = {'a','b','c'}; int str = sizeof(array)/sizeof(char); printf("...
分类:
编程语言 时间:
2014-07-29 11:15:46
阅读次数:
210
Base类只是一个指针,所以Base大小是4个字节。
但Base类中添加一个int a,Base的大小变成8字节。
#include
#include
using namespace std;
class Base1
{
public:
Base1(){cout << "Base1" << endl;}
~Base1(){cout << "~Base1" << endl;}
virtual void f(int){cout << "Base1 f(int...
分类:
编程语言 时间:
2014-07-28 15:47:13
阅读次数:
261
1字符数组的初始化: 1.1 char string={'c','h','i','n','a'} 1.2char string={"china"}或者去掉{}即char string=“china" 1.3 strcpy(string,"china")2字符串长度:字符串长度函数strlen(ch....
分类:
编程语言 时间:
2014-07-27 23:29:29
阅读次数:
272
#include#includeint main(){ int i = 0, j, k, r, table[200] = {0}, table2[200] = {0}; char st[100]; gets(st); k = strlen(st); for(i = 0;...
分类:
其他好文 时间:
2014-07-27 22:33:19
阅读次数:
259
#include #include#includeusing namespace std;#define maxn 10100#define cls(x) memset(x, 0, sizeof(x))//好了,感觉上面的这个变得更加的牛逼了,直接是让大家看起来是像调用了一个函数的样子,然后就得到了...
分类:
其他好文 时间:
2014-07-27 22:28:49
阅读次数:
220