Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Which Division CodeChef Solution

Problem – Which Division CodeChef Solution

This website is dedicated for CodeChef solution where we will publish right solution of all your favourite CodeChef problems along with detailed explanatory of different competitive programming concepts and languages.
<<Previous CodeChef Problem Next Codechef Problem>>

Which Division CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;cin>>t;
	while(t--){
	    int x;
	    cin>>x;
	    if(x>=2000){
	        cout<<1<<endl;
	        
	    }
	    else if(1600<=x and x<2000){
	        cout<<2<<endl;
	    }
	    else if(x<1600){
	        cout<<3<<endl;
	    }
	}
	return 0;
}

Which Division CodeChef Solution in C++14

#include <iostream>
using namespace std;

int main() {
        int t;
        cin>>t;
        while(t--)
        {
                int r;
                cin>>r;
                if(2000<=r) puts("1");
                else if(1600<=r && r<2000) puts("2");
                else if(r<1600) puts("3");
        }
	// your code goes here
	return 0;
}

Which Division CodeChef Solution in PYTH 3

"""
t = input()
begin
if 1<=t<=1000 
then repeat t
    r = input()
    if 1000<=r<=4500 then
        if 2000<=r
        then print 1
        else
        if 1600<=r<=2000 
        then print 2 
        else 
        if  r<1600 
        then print 3
        else 
        then return ("Invalid Input)
    else then output "invalid input"
else then output "invalid input"
"""
if __name__ == "__main__":
    t = int(input())
    if 1<=t<=1000:
        for i in range(t):
            r = int(input())
            if 1000<=r<=4500:
                if 2000<=r:
                    print("1")
                elif 1600<=r<=2000:
                    print("2")
                elif r<=1600:
                    print("3")
                else:
                    print("Error")
            else:
                print("invalid input")

Which Division CodeChef Solution in C

#include <stdio.h>
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int a;
        scanf("%d",&a);
        if(a>=2000)
        printf("1\n");
        else if(a<2000 && a>=1600)
        printf("2\n");
        else
        printf("3\n");
    }
    return 0;
}

Which Division 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
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] arr=new int[n];
		for(int i=0;i<n;i++)
		{
		    arr[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++)
		{
		    if(arr[i]>=2000)
		    {
		        System.out.println(1);
		    }
		    else if(arr[i]>=1600 && arr[i]<2000)
		    {
		        System.out.println(2);
		    }
		    else if(arr[i]<1600)
		    {
		        System.out.println(3);
		    }
		}
	}
}

Which Division CodeChef Solution in PYPY 3

t=int(input())
for i in range(t):
    a=int(input())
    if a>=2000:
        print("1")
    elif a>=1600 and a<2000:
        print("2")
    else:
        print("3")
    

Which Division CodeChef Solution in PYTH

# cook your code here
t=int(input())
for i in range(t):
    r=int(input())
    if(2000<=r):
        print("1")
    elif(1600<=r<2000):
        print("2")
    else:
        print("3")

Which Division CodeChef Solution in C#

using System;

public class Test
{
	public static void Main()
	{
		// your code goes here
		int T = int.Parse(Console.ReadLine());
		
		for (int i=0;i <T;i++)
		{
		    int R =int.Parse(Console.ReadLine());
		    Console.WriteLine(R < 1600 ? 3:R < 2000 ? 2:1);
		}
	}
}

Which Division CodeChef Solution in NODEJS

process.stdin.resume();
process.stdin.setEncoding('utf8');

// your code goes here

let input = ''

function checkInput(data) {
    input += data
}

function prepareInput() {
    input = input.split('\n')
}

function main() {
    prepareInput()
    
    let N = input.splice(0, 1)
    
    for(let i=0; i<N; i++) {
        let num = Number(input[i])
        
        let ans = num >= 2000 ? 1
                : num < 2000 && num >= 1600 ? 2
                : 3
                
        process.stdout.write(ans + '\n')
    }
}

process.stdin.on('data', checkInput).on('end', main)

Which Division CodeChef Solution in GO

package main

import (
	"fmt"
)

func main() {

	var t int
	fmt.Scanf("%d", &t)
	for ; t > 0; t-- {
		var a int
		fmt.Scanf("%d", &a)

		if a > 1999 {
			fmt.Println("1")
		} else if a > 1599 && a < 2000 {
			fmt.Println("2")
		} else {
			fmt.Println("3")
		}
	}
}

CodeChef Solution Review:

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

Find on CodeChef

Conclusion:

I hope this 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 Programming Language in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

Cognitive Class Answer

CodeChef Solution

Microsoft Learn

Leave a Reply

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