Chef and Interactive Contests CodeChef Solution

Problem – Chef and Interactive Contests CodeChef Solution

“Every beginning has an end… and an editorial.” – taran_1407

What the hell are all these interactive problems? What does flushing output mean? So many questions… Chef explains it in an easy way: you must communicate with a grader program, which accepts your input only if you flushed the output.

There is a contest with interactive problems where N people participate. Each contestant has a known rating. Chef wants to know which contestants will not forget to flush the output in interactive problems. Fortunately, he knows that contestants with rating at least r never forget to flush their output and contestants with rating smaller than r always forget to do it. Help Chef!

Input

  • The first line of the input contains two space-separated integers N and r.
  • Each of the following N lines contains a single integer RR denoting the rating of one contestant.

Output

For each contestant, print a single line containing the string "Good boi" if this contestant does not forget to flush the output or "Bad boi" otherwise.

Constraints

  • 1≤N≤1,000
  • 1,300≤r,R≤1,501

Subtasks

Subtask #1 (100 points): original constraints

Sample 1:

Input:
2 1500
1499
1501
Output:
Bad boi
Good boi

Chef and Interactive Contests CodeChef Solution in C++14

#include <iostream>
using namespace std;


int main() {
	// your code goes here
	int n,r;
	cin>>n>>r;
	int R[n];
for(int i=0;i<n;i++)
{
    cin>>R[i];
}
for(int i=0;i<n;i++)
{
    if(R[i]<r)
    cout<<"Bad boi"<<endl;
    else
    cout<<"Good boi"<<endl;
}
	return 0;
}

Chef and Interactive Contests CodeChef Solution in Java

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner input =  new Scanner(System.in);
		int N = input.nextInt();
		int r = input.nextInt();
		while(N-- > 0)
		{
		    int rating = input.nextInt();
		    if(rating >= r)
		    {
		        System.out.println("Good boi");
		    }
		    else
		    {
		        System.out.println("Bad boi");
		    }
		}
	}
}

Chef and Interactive Contests CodeChef Solution in Pyth 3

# cook your dish here
n,r=map(int,input().split())

for i in range(n):
    R=int(input())
    if R>=r:print("Good boi")
    else:print("Bad boi")
    
Chef and Interactive Contests CodeChef Solution Review:

In our experience, we suggest you solve this Chef and Interactive Contests CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Chef and Interactive Contests CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Chef and Interactive Contests CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published. Required fields are marked *