- 超长数字串
- 2018-04-05 10:42:44 @
#include <iostream>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <cstring>
using namespace std;
char mom[1000000];
int main(void)
{
int cnt, i;
char num[10];
for (cnt = 1; cnt < 30000; cnt++)
{
sprintf(num, "%d", cnt);
strcat(mom, num);
}
char sourse[201];
for (i = 0;; i++)
{
sourse[i] = getchar();
if (sourse[i] == '\n')
{
sourse[i] = '\0';
break;
}
}
char *address = strstr(mom, sourse);
cout << address - mom + 1;
return 0;
}
0 条评论
目前还没有评论...