Which Division: WHICHDIV

link: https://www.codechef.com/CU1PP0010/problems/WHICHDIV

Given the rating RR of a person, tell which division he belongs to. The rating range for each division are given below:

  • Division 11: 2000≤2000≤ Rating.
  • Division 22: 1600≤1600≤ Rating <2000<2000.
  • Division 33: Rating <1600<1600.

Input Format

  • The first line of the input contains TT – the number of test cases. Then the test cases follow.
  • Each testcase contains a single line of input, which contains a single integer RR.

Output Format

For each test case, output on a single line the answer: 11 if the person belongs to Division 11, 22 if the person belongs to Division 22, and 33 if the person belongs to Division 33.

Constraints

  • 1≤T≤10001≤T≤1000
  • 1000≤R≤45001000≤R≤4500

Sample Input 1 

3
1500
4000
1900

Sample Output 1 

3
1
2

Explanation

Test case 11: Since the rating of the person lies in the range [1000,1600)[1000,1600), he belongs to Division 33.

Test case 22: Since the rating of the person lies in the range [2000,4500][2000,4500], he belongs to Division 11.

Test case 33: Since the rating of the person lies in the range [1600,2000)[1600,2000), he belongs to Division 22.

Solution:

//Code by PROGIES
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)

int main(){
	fastio;

	int tests;
	cin >> tests;

	while(tests--){
		int r;
		cin >> r;
		if(r >= 2000){
			cout << 1 << endl;
		}
		else if(r >= 1600){
			cout << 2 << endl;
		}
		else{
			cout << 3 << endl;
		}
	}

	return 0;
}


See also  Shoe Fit: SHOEFIT