Wednesday, January 15, 2014

codechef ERROR - "chef and feedback" solution

codechef ERROR - "chef and feedback": http://www.codechef.com/problems/ERROR

codechef ERROR - "chef and feedback" solution: http://ideone.com/h7ahmj

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main() {
int t, flag, n;
char c[100000];
scanf("%d", &t);
while(t--) {
scanf("%s", c); 
flag=0; n=strlen(c);
for(int i=0; i<n-2; i++) {
if(c[i]=='1' && c[i+1]=='0' && c[i+2]=='1') { printf("Good\n"); flag=1; break; }
else if(c[i]=='0' && c[i+1]=='1' && c[i+2]=='0') { printf("Good\n"); flag=1; break; }
}
if(flag==0) printf("Bad\n");
}
return 0;
}

No comments:

Post a Comment