CodeForces - 1669A Division?

Posted on   zeitspeed  阅读(65)  评论(0编辑  收藏  举报

Codeforces separates its users into 44 divisions by their rating:

For Division 1: 1900 \leq \mathrm{rating}1900≤rating
For Division 2: 1600 \leq \mathrm{rating} \leq 18991600≤rating≤1899
For Division 3: 1400 \leq \mathrm{rating} \leq 15991400≤rating≤1599
For Division 4: \mathrm{rating} \leq 1399rating≤1399
Given a \mathrm{rating}rating, print in which division the \mathrm{rating}rating belongs.

Input
The first line of the input contains an integer tt (1 \leq t \leq 10^41≤t≤10
4
) — the number of testcases.

The description of each test consists of one line containing one integer \mathrm{rating}rating (-5000 \leq \mathrm{rating} \leq 5000−5000≤rating≤5000).

Output
For each test case, output a single line containing the correct division in the format “Division X”, where XX is an integer between 11 and 44 representing the division for the corresponding rating.

Sample 1
Inputcopy Outputcopy
7
-789
1299
1300
1399
1400
1679
2300
Division 4
Division 4
Division 4
Division 4
Division 3
Division 2
Division 1
Note
For test cases 1-41−4, the corresponding ratings are -789−789, 12991299, 13001300, 13991399, so all of them are in division 44.

For the fifth test case, the corresponding rating is 14001400, so it is in division 33.

For the sixth test case, the corresponding rating is 16791679, so it is in division 22.

For the seventh test case, the corresponding rating is 23002300, so it is in division 11.

#include<iostream>
using namespace std;
int main(void) {
	int n;
	cin >> n;
	int m;
	for (int i = 0; i < n; i++) {
		cin >> m;
		if (m < 1400) {
			cout << "Division 4" << endl;
		}
		else {
			if (m < 1600) {
				cout << "Division 3" << endl;
			}
			else {
				if (m < 1900) {
					cout << "Division 2" << endl;
				}
				else {
					cout << "Division 1" << endl;
				}
			}
		}
	}
}
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示