C - Football
Problem description
Petya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a piece of paper. To simplify the situation he depicted it as a string consisting of zeroes and ones. A zero corresponds to players of one team; a one corresponds to players of another team. If there are at least 7 players of some team standing one after another, then the situation is considered dangerous. For example, the situation 00100110111111101 is dangerous and 11110111011101 is not. You are given the current situation. Determine whether it is dangerous or not.
Input
The first input line contains a non-empty string consisting of characters "0" and "1", which represents players. The length of the string does not exceed 100characters. There's at least one player from each team present on the field.
Output
Print "YES" if the situation is dangerous. Otherwise, print "NO".
Examples
Input
001001
Output
NO
Input
1000000001
Output
YES
解题思路:简单处理字符串,如果有连续相同的数字不小于7个,则输出"YES",否则输出"NO"。
AC代码:
#include <bits/stdc++.h>
using namespace std;
int main()
{
char a[];int cnt=,i=;bool flag=false;
cin>>a;
while(a[i]!='\0'){
if(a[i]==''){while(a[i]==''){cnt++;i++;}}
else{while(a[i]==''){cnt++;i++;}}
if(cnt>=){flag=true;break;}
cnt=;
}
if(flag)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return ;
}
C - Football的更多相关文章
- POJ 3071 Football
很久以前就见过的...最基本的概率DP...除法配合位运算可以很容易的判断下一场要和谁比. from——Dinic算法 Football Time ...
- Football Foundation (FOFO) TOJ 2556
The football foundation (FOFO) has been researching on soccer; they created a set of sensors to desc ...
- 17111 Football team
时间限制:1000MS 内存限制:65535K 提交次数:0 通过次数:0 题型: 编程题 语言: C++;C Description As every one known, a footbal ...
- CodeForces 432B Football Kit
Football Kit Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Subm ...
- Football(POJ3071)
Football Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3469 Accepted: 1782 Descript ...
- 16年大连网络赛 1006 Football Games
题目链接:http://acm.hdu.edu.cn/contests/contest_showproblem.php?cid=725&pid=1006 Football Games Time ...
- 三分--Football Goal(面积最大)
B - Football Goal Time Limit:500MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Su ...
- HDU5873:Football Games
题目链接: Football Games 分析: 先将分数排序,然后 设当前队编号为p,设个指针为p+1,然后p>1,每次p-=2,指针右移一位p==1,指针指向的队-=1p==0,从指针开始到 ...
- Codeforces Gym 100425H H - Football Bets 构造
H - Football BetsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...
- Football
Football Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2882 Accepted: 1466 Descript ...
随机推荐
- CAD从二制流数据中加载图形(com接口)
主要用到函数说明: _DMxDrawX::ReadBinStream 从二制流数据中加载图形,详细说明如下: 参数 说明 VARIANT varBinArray 二制流数据,是个byte数组 BSTR ...
- Luogu P1187 3D模型
题目描述 一座城市建立在规则的n×m网格上,并且网格均由1×1正方形构成.在每个网格上都可以有一个建筑,建筑由若干个1×1×1的立方体搭建而成(也就是所有建筑的底部都在同一平面上的).几个典型的城市模 ...
- A water problem (hdu-5832)
不多说就是一个数对两个数的乘积求模运算 不得不说vj上这个题的翻译版本真是太暴力了 难点 主要还是时间的控制,这题太容易TLE了.用到的算法就是大数求余数的ans=(ans*10-a[i]-'0')% ...
- Spring MVC 笔记 概述
学习笔记 模型:封装装程序数据 视图:渲染模型数据,一般来说就是输出HTML 控制:处理请求,构建模型并将其传递给视图进行渲染 以上三者均围绕DispatcherServlet设计,它处理所有的HTT ...
- 取代PHP原生函数的一些扩展包
前言 虽然程序员无时无刻都在造轮子,但造轮子也有效率之分,用好轮子才能造出好"
- 5.2.2 re模块方法与正则表达式对象
Python标准库re提供了正则表达式操作所需要的功能,既可以直接使用re模块中的方法,来实现,也可以把模式编译成正则表达式对象再使用. 方法 功能说明 complie(pattern[,flagss ...
- Linq表达式写法
Linq表达式,实现按照某个字段排序的简单写法. 做项目的时候遇到的一个简单问题,于是记下来. 列举一个例子: <T> model=new <T>(); 加入model中有要根 ...
- 关于PyQt5,在pycharm上的安装步骤及使用技巧
前序 之前学习了一款GUI图形界面设计的Tkinter库,但是经大佬的介绍,PyQT5全宇宙最强,一脸的苦笑 毫不犹豫的选择转战PyQT5,在学习之前需要先安装一些必须程序,在一番查阅后,发现PyQt ...
- GeoTrust 企业(OV)型 SSL证书
GeoTrust True BusinessID SSL证书属于企业验证(OV)级别的SSL证书,验证域名所有权,验证企业单位信息,提供40位/56位/128位,最高支持256位自适应加密,被20 ...
- 【codeforces 515D】Drazil and Tiles
[题目链接]:http://codeforces.com/contest/515/problem/D [题意] 给你一个n*m的格子; 然后让你用1*2的长方形去填格子的空缺; 如果有填满的方案且方案 ...