标签:general clu strong 题目 VID examples contains size game
Codeforces Round #573 (Div. 2)
A. Tokitsukaze and Enhancement
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:
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?
Input
The only line contains a single integer x (30≤x≤100) — the value Tokitsukaze‘s HP currently.
Output
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.
Examples
input
33
output
0 A
input
98
output
1 B
Note
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:
Therefore, the best way is to increase her HP by 1 so that the category of her HP becomes B.
题意:题目意思是给一个数根据mod 4 的四个结果定义等级,余1等级A,余3等级B,余2等级C,余0等级D。
问给你一个数,你可以对数加a:0<=a<=2,问这个数能提升到的最高等级和对应的a。
思路:直接讨论四种情况的最优解就好了,例如n mod 4 = 3 时,显然加2就变成 余1为等级A了......
1 #include<iostream>
2 #include<cstdio>
3 #include<cstring>
4 #include<algorithm>
5 #include<map>
6 #include<set>
7 #include<vector>
8 #include<queue>
9 #include<cmath>
10 using namespace std;
11 #define ll long long
12 const int mod=1e9+7;
13 const int inf=1e9+7;
14
15 //const int maxn=
16 int main()
17 {
18 ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
19 int n;
20 while(cin>>n)
21 {
22 if(n%4==1)
23 cout<<0<<" "<<"A"<<endl;
24 else if(n%4==2)
25 cout<<1<<" "<<"B"<<endl;
26 else if(n%4==3)
27 cout<<2<<" "<<"A"<<endl;
28 else if(n%4==0)
29 cout<<1<<" "<<"A"<<endl;
30 }
31 return 0;
32 }
Codeforces Round #573 (Div. 2) A. Tokitsukaze and Enhancement
标签:general clu strong 题目 VID examples contains size game
原文地址:https://www.cnblogs.com/xwl3109377858/p/11182079.html