CF1191A.Tokitsukaze and Enhancement
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Tokitsukaze is one of the characters in the game "Kantai Collection". In this game, every character has a common attribute — health points, shortened to HP.
In general, different values of HP are grouped into 4 categories:
- Category A if HP is in the form of (4n+1), that is, when divided by 4, the remainder is 1;
- Category B if HP is in the form of (4n+3), that is, when divided by 4, the remainder is 3;
- Category C if HP is in the form of (4n+2), that is, when divided by 4, the remainder is 2;
- Category D if HP is in the form of 4n, that is, when divided by 4, the remainder is 0.
The above-mentioned n can be any integer.
These 4 categories ordered from highest to lowest as A>B>C>D, which means category A is the highest and category D is the lowest.
While playing the game, players can increase the HP of the character. Now, Tokitsukaze wants you to increase her HP by at most 2 (that is, either by 0, 1 or 2). How much should she increase her HP so that it has the highest possible category?
“时雨”是游戏《舰队Collection》中的角色之一。在该游戏中,每个角色都具有一个通用属性——生命值(Hit Points),简称为 HP。
通常,不同的 HP 值被划分为 4 个类别:
- 若 HP 形如 (4n+1),即除以 4 余数为 1,则属于 A 类;
- 若 HP 形如 (4n+3),即除以 4 余数为 3,则属于 B 类;
- 若 HP 形如 (4n+2),即除以 4 余数为 2,则属于 C 类;
- 若 HP 形如 4n,即除以 4 余数为 0,则属于 D 类。
其中,上述 n 可取任意整数。
这 4 个类别的优先级从高到低依次为:A>B>C>D,即 A 类最高,D 类最低。
在游戏中,玩家可以提升角色的 HP。现在,“时雨”希望你最多将她的 HP 提升 2 点(即提升 0、1 或 2 点)。那么,她应将 HP 提升多少点,才能使其所属类别尽可能高?
输入格式
The only line contains a single integer x (30≤x≤100) — the value Tokitsukaze's HP currently.
唯一的一行包含一个整数 x(30≤x≤100)—— 表示时雨酱当前的生命值(HP)。
输出格式
Print an integer a (0≤a≤2) and an uppercase letter b (b∈{A,B,C,D}), representing that the best way is to increase her HP by a, and then the category becomes b.
Note that the output characters are case-sensitive.
输出一个整数 a(0≤a≤2)和一个大写字母 b(b∈{A,B,C,D}),表示最优策略是将她的 HP 增加 a,之后其类别变为 b。
注意:输出的字符区分大小写。
输入输出样例
输入#1
33
输出#1
0 A
输入#2
98
输出#2
1 B
说明/提示
For the first example, the category of Tokitsukaze's HP is already A, so you don't need to enhance her ability.
For the second example:
- If you don't increase her HP, its value is still 98, which equals to (4×24+2), and its category is C.
- If you increase her HP by 1, its value becomes 99, which equals to (4×24+3), and its category becomes B.
- If you increase her HP by 2, its value becomes 100, which equals to (4×25), and its category becomes D.
Therefore, the best way is to increase her HP by 1 so that the category of her HP becomes B.
对于第一个样例,时雨泽的 HP 类别已经是 A,因此无需提升她的能力。
对于第二个样例:
- 如果不提升她的 HP,其值仍为 98,即 (4×24+2),类别为 C。
- 如果将她的 HP 提升 1,其值变为 99,即 (4×24+3),类别变为 B。
- 如果将她的 HP 提升 2,其值变为 100,即 (4×25),类别变为 D。
因此,最优方案是将她的 HP 提升 1,使其 HP 类别变为 B。
输入解题思路,AI测评打分。不知道怎么写?