Codeforces 96A Football Solution

Slve in C:

#include<stdio.h>
int main()
{

    int i,len,one=0,zero=0,flag=0,j;
    char n[101];
    while(scanf("%s",n)!=EOF)
    {
        len=strlen(n);

        for(i=0; i<len-6; i++)

        {
            if(n[i]=='1'&&n[i+1]=='1'&&n[i+2]=='1'&&n[i+3]=='1'&&n[i+4]=='1'&&n[i+5]=='1'&&n[i+6]=='1')
            {
                flag=7;
                break;
            }

            else if(n[i]=='0'&&n[i+1]=='0'&&n[i+2]=='0'&&n[i+3]=='0'&&n[i+4]=='0'&&n[i+5]=='0'&&n[i+6]=='0')
            {
                flag=7;
                break;
            }


        }

        if(flag==7)
        {
            printf("YES\n");

        }

        else
        {
            printf("NO\n");
        }


    }


}

No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h ...

Powered by Blogger.