Sunday, May 29, 2016

CODEFORCES problem 96/A Football

Problem link (Click here)

#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

int main()
{
    string team ;
    int i;
    int a=0, b=0;
    int length;
    cin >> team;
    length = team.size();
    for(i=0; i< length; i++){
        if(team[i]== '1'){
            a++;
            b=0;
        }
        else if(team[i]== '0'){
            b++;
            a=0;
        }
        if(a >= 7 || b >= 7)
            break;
    }

    if(a >= 7 || b >= 7)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}

3 comments:

  1. I don't understand this problem do you plz explain more.TIA

    ReplyDelete
  2. This is a great article thanks for sharing this informative information. I will visit your blog regularly for some latest post. I will visit your blog regularly for Some latest post. บอลออนไลน์UFA800

    ReplyDelete
  3. it showing error ,can you tell me in which language you explain?

    ReplyDelete