304 North Cardinal St.
Dorchester Center, MA 02124

Good Program CodeChef Solution

Problem – Good Program CodeChef Solution

In computing, the collection of four bits is called a nibble.

Chef defines a program as:

• Good, if it takes exactly X nibbles of memory, where X is a positive integer.
• Not Good, otherwise.

Given a program which takes N bits of memory, determine whether it is Good or Not Good.

Input Format

• First line will contain T, number of test cases. Then the test cases follow.
• The first and only line of each test case contains a single integer N, the number of bits taken by the program.

Output Format

For each test case, output Good or Not Good in a single line. You may print each character of Good or Not Good in uppercase or lowercase (for example, GoOd, GOOD, good will be considered identical).

Constraints

• 1≤T≤1000
• 1≤N≤1000

Subtask #1 (100 points): original constraints

Sample 1:

``````Input: 4
8
17
52
3
Output: Good
Not Good
Good
Not Good``````

Explanation:

Test case 1: The program requires 8 bits of memory. This is equivalent to 48​=2 nibbles. Since 2 is an integer, this program is good.

Test case 2: The program requires 17 bits of memory. This is equivalent to 417​=4.25 nibbles. Since 4.25 is not an integer, this program is not good.

Test case 3: The program requires 52 bits of memory. This is equivalent to 452​=13 nibbles. Since 13 is an integer, this program is good.

Test case 4: The program requires 3 bits of memory. This is equivalent to 43​=0.75 nibbles. Since 0.75 is not an integer, this program is not good.

Good Program CodeChef Solution in C++17

``````#include <iostream>
using namespace std;

int main() { int t;
cin>>t;
while(t--){
int n;
cin>>n;
if(n%4==0){
cout<<"good"<<endl;

}
else{cout<<"not good"<<endl;
}}
return 0;
}
``````

Good Program CodeChef Solution in Pyth 3

``````# cook your dish here
for tc in range(int(input())):
N=int(input())
if N%4==0:
print('Good')
else:
print('not good')``````

Good Program CodeChef Solution in Java

``````/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner (System.in);
int t=sc.nextInt();

for(int i=0;i<t;i++){
int n=sc.nextInt();

if(n%4==0){
System.out.println("Good");
}
else if(n%4!=0){
System.out.println("Not Good");
}

}
}
}
``````
Good Program CodeChef Solution Review:

In our experience, we suggest you solve this Good Program 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 Good Program CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Good Program 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