- 博客(8)
- 收藏
- 关注
原创 uva455 周期串 第三章习题4
A character string is said to have period k if it can be formed by concatenating one or more repetitions of another string of length k. For example, the string ”abcabcabcabc” has period 3, since it is
2017-04-10 20:11:33 304
原创 uva1225 数数字 字符串与数组03-习题3
Trung is bored with his mathematics homeworks. He takes a piece of chalk and starts writing a sequence of consecutive integers starting with 1 to N (1 < N < 10000). After that, he counts the number of
2017-04-10 17:04:22 245
原创 c++ vector向量
一、向量的介绍 向量 vector 是一种对象实体, 能够容纳许多其他类型相同的元素, 因此又被称为容器。 与string相同, vector 同属于STL(Standard Template Library, 标准模板库)中的一种自定义的数据类型, 可以广义上认为是数组的增强版。 在使用它时, 需要包含头文件 vector, #include
2017-04-10 15:39:56 441
原创 uva1586 字符串与数组03-习题2
#include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <cstring>#include <cctype>using namespace std;int main(){ int t; int m=0; double sum=0; char s[
2017-04-07 16:56:31 388
原创 字符串与数组03-例题3 Palindromes,UVa401
A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string “ABCDEDCBA” is a palindrome because it is the same when the string is read from left
2017-04-05 21:19:43 256
原创 字符串与数组03-例题-2 (WERTYU,UVa 10082)
#include <cstring>#include <cstdio>int main(){ int c,i; char s[]="'1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./"; while((c=getchar())!=EOF) { for(i=1; s[i]&&s[i]!=c; i++);
2017-04-05 19:07:56 325
原创 strchr的用法
strchr(char *s,char *c) 查找字符c第一次出现在字符串s中的位置 返回值:如果找到指定的字符则返回该字符所在地址;否则返回NULL.例1:#include <cstring>#include <cstdio>int main(){ char sstring[17]; char *ptr,c='r'; strcpy(sstring,"thisis
2017-04-05 12:57:42 3716
原创 malloc用法及与new区别
一、原型:extern void *malloc(unsigned int num_bytes); 头文件:#include #include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <cstring>using namespace std;int main(){ char
2017-04-01 10:10:29 306
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人