
正文
codeforces水题100道 第二十三题 Codeforces Beta Round #77 (Div. 2 Only) A. Football (strings)
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
题目链接:http://www.codeforces.com/problemset/problem/96/A
题意:判断一个0-1字符串中出现的最长的0字串或者1字串的长度是否大于等于7。
C++代码:
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
string s;
int tmp = ;
bool chk()
{
int len = s.length();
for (int i = ; i < len; i ++)
if (s[i] == s[i-])
{
tmp ++;
if (tmp >= )
return true;
}
else
tmp = ;
return false;
}
int main()
{
cin >> s;
puts(chk() ? "YES" : "NO");
return ;
}
C++







