沐枫NOI 14. Football
来源:互联网 发布:英雄传奇挂机软件 编辑:程序博客网 时间:2024/06/16 14:59
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 100 characters. 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
#include<iostream>#include<cstdio>#include<algorithm>#include<vector>#include<set>#include<queue>#include<cstring>using namespace std;int main(){char a[1000];scanf("%s",a);int len=strlen(a);int pro=a[0];int sum=1;for(int i=1;i<len;i++){if(a[i]==pro){sum++;if(sum>=7){printf("YES\n");return 0;}}else{sum=1;pro=a[i];}}printf("NO\n");return 0;}
- 沐枫NOI 14. Football
- Football
- Football
- Football
- Football
- Football
- Football
- 沐枫NOI 10. Leaders
- 沐枫NOI 17. Volleyball
- 沐枫NOI 28. Queue
- NOI
- 沐枫NOI 21. Restoring Password
- 沐枫NOI 25. Binary Number
- 沐枫NOI 30. African Crossword
- 沐枫NOI 2839. 单词替换
- 沐枫NOI 6. Help Chef Gerasim 模拟
- 沐枫NOI 7. Help Far Away Kingdom
- 沐枫NOI 13. Lucky Numbers (easy)
- LintCode-[容易] 211. 字符串置换
- 学习ajax
- 沐枫NOI 13. Lucky Numbers (easy)
- 分治法2
- 习题4.1(3)假设程序运行时输入123456.
- 沐枫NOI 14. Football
- POJ
- 马克思手稿中的趣味数学题。
- 各种数学和几何所用的代码即相关定理
- 5.3
- Spring 中的 Environment
- 时钟
- 去除两个 inline-block 之间的间距
- 沐枫NOI 17. Volleyball