Search
 
SCRIPT & CODE EXAMPLE
 

CPP

Chef and Feedback codechef solution in cpp

#include<iostream>
using namespace std;

int main()
{

	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		int cnt = 0;
		for (int j = 0; j < s.length(); j++)
		{
			if (s[j] == '0' && s[j + 1] == '1' && s[j + 2] == '0')
				cnt++;
			else if (s[j] == '1' && s[j + 1] == '0' && s[j + 2] == '1')
				cnt++;
		}
		if (cnt >= 1)
			cout << "Good
";
		else
			cout << "Bad
";
		
	}

	return 0;
}
Comment

Chef and Feedback codechef solution in cpp

#include<iostream>
using namespace std;

int main()
{

	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		int cnt = 0;
		for (int j = 0; j < s.length(); j++)
		{
			if (s[j] == '0' && s[j + 1] == '1' && s[j + 2] == '0')
				cnt++;
			else if (s[j] == '1' && s[j + 1] == '0' && s[j + 2] == '1')
				cnt++;
		}
		if (cnt >= 1)
			cout << "Good
";
		else
			cout << "Bad
";
		
	}

	return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: convert ros time to double 
Cpp :: c++ suare 
Cpp :: c++ map value int to string 
Cpp :: opencv read gif c++ 
Cpp :: how to declare a function in c++ header file 
Cpp :: online c++ compiler 
Cpp :: what is c++ function 
Cpp :: c++ loop vector iterator 
Cpp :: what does : mean in c++ 
Cpp :: concatenate 2 vectors in c++ 
Cpp :: c++ cin string 
Cpp :: stream in c++ 
Cpp :: std::string remove last 
Cpp :: declaring multiple variables in cpp 
Cpp :: what is ++i and i++ 
Cpp :: c++ generate random number upper and lower bound 
C :: powershell search files for string 
C :: get pid c 
C :: lewis hamilton 
C :: printf boo; 
C :: c data types 
C :: sigaction in c 
C :: libdvd-pkg: `apt-get check` failed 
C :: how to print a file c 
C :: c program to add two numbers 
C :: union in c 
C :: c program to find the factorial of a number 
C :: strcasecmp c 
C :: initializa 2d array c 
C :: print variable adress c 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =