看看我们机房某畸形写的题解:http://blog.csdn.net/sinat_27410769/article/details/46754209此题为popoQQQ神犇所出,在此orz#include
#include
#include
#define maxl 10000001long long ans;
long long f[maxl];
b...
分类:
其他好文 时间:
2015-07-04 12:45:09
阅读次数:
126
// 模拟库函数strstr
#include
#include
const char* my_strstr(const char *parent, const char *child)
{
const char *pgo = parent;
const char *cgo = child;
const char *pgos = parent;
assert(parent != ...
分类:
编程语言 时间:
2015-07-04 12:43:16
阅读次数:
216
题意:给出n个数和Q个询问(l,r),对于每个询问求出(l,r)之间连续出现次数最多的次数。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 #...
分类:
其他好文 时间:
2015-07-04 12:37:53
阅读次数:
144
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1035因为结果要么是有限小数要么是无限循环小数,那么只要模拟这个过程,然后判断循环就跳出,记录循环次数就好。 1 #include 2 #include 3 #inclu.....
分类:
其他好文 时间:
2015-07-04 12:33:27
阅读次数:
125
//判断一个字符串是否是一个字符串的旋转字符串
//利用库函数实现
#include
#include
#include
int IsRotate(char *str1, const char *str2)
{
assert(str1);
assert(str2);
strncat(str1, str1,strlen(str1));
if (NULL == strstr(str1, ...
分类:
编程语言 时间:
2015-07-04 11:20:31
阅读次数:
211
//字符串替换空格:实现一个函数,把字符串里的空格替换成“%20”
#include
#include
void replace(char *src)
{
assert(src);
int OldLen = 0; //原字符串长度
int NewLen = 0; //新字符串长度
int BlackNum = 0; ...
分类:
编程语言 时间:
2015-07-04 11:20:25
阅读次数:
357
//模拟实现库函数strstr,查找子字符串
#include
#include
char * my_strstr( char *dst, const char * src)
{
assert(dst);
assert(src);
int i, j, k;
for (i = 0; dst[i] != '\0'; i++)
{
for (j = i, k = 0; src[k] !...
分类:
编程语言 时间:
2015-07-04 11:19:02
阅读次数:
174
//编写函数实现字符串旋转
#include
#include
#include
void reverse(char *left, char *right)
{
char temp;
assert(left);
assert(right);
while (right > left)
{
temp = *left;
*left = *right;
*right =...
分类:
编程语言 时间:
2015-07-04 11:18:31
阅读次数:
217
//编写函数实现库函数atoi,把字符串转换成整形
#include
#include
int my_atoi(const char *src)
{
int flag=1;
int sum=0;
while (*src)
{
if (*src == ' ')
src++;
else if (*src == '+')
{
src++;
flag = 1;
...
分类:
编程语言 时间:
2015-07-04 11:18:03
阅读次数:
156
// 字符串替换空格:请实现一个函数,把字符串中的每个空格替换成“%20”。
// 例如输入“we are happy.”,则输出“we%20are%20happy.”
#include
#include
char* replace(char* p)
{
char* ret = p;
int num = 0;
int oldlen = 0;
int newlen = 0;
...
分类:
编程语言 时间:
2015-07-04 11:16:59
阅读次数:
181