这道题可以用“滑动窗口”的思想来做,假想一个滑动的窗口,这个窗口的大小是s,划过一个大小为n的区域,但是因为s可能比n大,所以我们不妨不去考虑s和n的大小,直接开出一个足够大的空间s+s+n,用ok[i]表示以i结尾的窗口是否符合要求。如果最后结果ans == n + 1 ,那么这个说明n
代码如下:
#include
using namespace std;
const int maxn =...
分类:
其他好文 时间:
2015-07-04 22:19:00
阅读次数:
171
#include
int main(void)
{
char ch;
ch = 7;
int count = 20;
/*printf("%c",ch);
printf("\007");
printf("\a");
printf("\7");
printf("\x7");
printf("%c",'\7');*/
printf("Hello\073\n");
print...
分类:
编程语言 时间:
2015-07-04 22:15:59
阅读次数:
186
一句话概括,就是class可以实例化module不可以别的都一样关于继承的一点区别class是使用<作为继承的关键字,只支持单继承module是使用include来做实例继承(实例化的时候动态功能插入),extend做类继承(可以理解为static继承)module的应用场景作为namespace,...
分类:
其他好文 时间:
2015-07-04 22:10:54
阅读次数:
184
#include
#include
int strstrcount( char *str1, char *str2 )
{
char *str = str1;
int c = 0;
while( (str = strstr( str, str2 )) != NULL )
{
c++;
str++;
}
return c;
}
int main()
{...
分类:
其他好文 时间:
2015-07-04 21:04:33
阅读次数:
131
#include
char *mystrcpy(char *s1,char*s2)
{
char *p=s1;
while(*s2!='\0')
{
*s1++=*s2++;
}
*s1='\0';
return p;
}
int main()
{
char a[20]="welcome to anyang";
char b[20]="";
printf("%s\n",mys...
分类:
其他好文 时间:
2015-07-04 21:03:37
阅读次数:
228
#include#includeusing namespace std;void main(){////find函数返回类型 size_typestring s("1a2b3c4d5e6f7g8h9i1a2b3c4d5e6f7g8ha9i");string flag;string::size_typ...
分类:
编程语言 时间:
2015-07-04 20:52:17
阅读次数:
189
#include
void select_sort(int *a,int n)
{
int i,j;
for(i = 0;i<n-1;i++)
{
for(j = i+1;j *(a+j))
{
int temp;
temp = *(a+i);
*(a+i) = *(a+j);
*(a+j) = t...
分类:
编程语言 时间:
2015-07-04 19:49:54
阅读次数:
200
#include
int mystrlen(char *p)
{
int size = 0;
if(!p)//如果是空指针
return -1;
while(*p)
{
p++;
size++;
}
return size;
}
int main()
{
char *s;
char c[20];
s=c;
g...
分类:
其他好文 时间:
2015-07-04 19:49:43
阅读次数:
174
#include
void bubble_sort(int *a,int n)
{
int i,j;
for(i = 0;i<n;i++)
{
for(j = i;j *(a+j))
{
int temp;
temp = *(a+i);
*(a+i) = *(a+j);
*(a+j) = temp;...
分类:
编程语言 时间:
2015-07-04 19:47:43
阅读次数:
185
1.概念我们可以使用typedef关键字为各种数据类型定义一个新名字(别名)。2.作用:给已经存在的类型起一个新的名称3.使用场合:1> 基本数据类型2> 指针3> 结构体4> 枚举5> 指向函数的指针4.代码 1 #include 2 3 typedef int MyInt; 4 ty...
分类:
编程语言 时间:
2015-07-04 19:47:36
阅读次数:
190