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");
}
}
}
#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