Division? (Codeforces 1669A)
Tags: Implement, implementation

Codeforces separates its users into $$$4$$$ divisions by their rating:  For Division 1: $$$1900 \leq \mathrm{rating}$$$  For Division 2: $$$1600 \leq \mathrm{rating} \leq 1899$$$  For Division 3: $$$1400 \leq \mathrm{rating} \leq 1599$$$  For Division 4: $$$\mathrm{rating} \leq 1399$$$ Given a $$$\mathrm{rating}$$$, print in which division the $$$\mathrm{rating}$$$ belongs.

Input: The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of testcases.The description of each test consists of one line containing one integer $$$\mathrm{rating}$$$ ($$$-5000 \leq \mathrm{rating} \leq 5000$$$).

Output: For each test case, output a single line containing the correct division in the format "Division X", where $$$X$$$ is an integer between $$$1$$$ and $$$4$$$ representing the division for the corresponding rating.

Note: For test cases $$$1-4$$$, the corresponding ratings are $$$-789$$$, $$$1299$$$, $$$1300$$$, $$$1399$$$, so all of them are in division $$$4$$$.For the fifth test case, the corresponding rating is $$$1400$$$, so it is in division $$$3$$$.For the sixth test case, the corresponding rating is $$$1679$$$, so it is in division $$$2$$$.For the seventh test case, the corresponding rating is $$$2300$$$, so it is in division $$$1$$$.

Sample Inputs:
7
-789
1299
1300
1399
1400
1679
2300

Sample Outputs:
Division 4
Division 4
Division 4
Division 4
Division 3
Division 2
Division 1

Solution (Python):
t = int(input())
res = []
for i in range(t):
    rat = int(input())
    if rat >= 1900:
        res.append('Division 1')
    elif rat >= 1600 and rat <= 1899:
        res.append('Division 2')
    elif rat >= 1400 and rat <= 1599:
        res.append('Division 3')
    elif rat <= 1399:
        res.append('Division 4')
for i in range(t):
    print(res[i])

Solution (Python):
a = int(input())
c = []
for i in range(a):
    b = int(input())
    if b >= 1900:
        c.append('Division 1')
    elif b >= 1600 and b <= 1899:
        c.append('Division 2')
    elif b >= 1400 and b <= 1599:
        c.append('Division 3')
    else:
        c.append('Division 4')
print('\n'.join(c))

Solution (Python):
import sys
input = sys.stdin.readline

def inp():
    return int(input())

def inl():
    return map(int, input().split())

def inlt():
    return list(map(int, input().split()))

def insr():
    s = input()
    return list(s[:len(s) - 1])

def invr():
    return map(int, input().split())
for t in range(inp()):
    a = inp()
    print('Division ', end='')
    if a < 1400:
        print(4)
    elif a < 1600:
        print(3)
    elif a < 1900:
        print(2)
    else:
        print(1)