zoukankan      html  css  js  c++  java
  • Codeforces Round #573 (Div. 2).A

    A - Tokitsukaze and Enhancement

    题目链接:http://codeforces.com/contest/1191/problem/A

    题目:

    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?
    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:
     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.

    题意:

    Tokitsukaze是游戏“Kantai Collection”中的角色之一。在这个游戏中,每个角色都有一个共同的属性 - 健康点,缩短为HP。

    通常,不同的HP值分为4类:A类

    如果HP是(4n + 1)的形式,也就是说,当除以4时,余数为1;
    B类
    如果HP的形式为(4n + 3),即除以4,则余数为3;
    C类
    如果HP的形式为(4n + 2),即除以4,则余数为2;
    D类
    如果HP是4n的形式,也就是说,当除以4时,余数为0

    上述n可以是任何整数。

    这4个
    从A到B> C> D从最高到最低排序的类别,这意味着A类最高,D类最低。

    在玩游戏时,玩家可以增加角色的HP。现在,Tokitsukaze希望你将她的HP增加至多2
    (即0,1或2)。她应该增加多少HP以使其具有最高级别?
    输入

    唯一的行包含一个整数x
    (30≤x≤100) - 目前Tokitsukaze的HP值。
    产量

    打印一个整数a(0≤a≤2)和一个大写字母b(b∈{A,B,C,D}),表示最好的方法是将她的HP增加a,然后该类别变为b
    请注意,输出字符区分大小写。
    例子
    输入
    33
    产量
    0 A.
    输入
    98
    产量
    1 B
    注意

    对于第一个例子,Tokitsukaze的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.

    思路:模拟即可

    #include<iostream>
    #include<queue>
    #include<cstring>
    #include<cstdio>
    using namespace std;
    
    const int maxn=2e5+7;
    
    int main()
    {
        int n;
        while(cin>>n) {
            if(n%4==1)
                printf("0 A
    ");
            else if(n%4==2)
                printf("1 B
    ");
            else if(n%4==3)
                printf("2 A
    ");
            else
                printf("1 A
    ");
        }
        return 0;
    }
  • 相关阅读:
    zoj 2316 Matrix Multiplication 解题报告
    BestCoder7 1001 Little Pony and Permutation(hdu 4985) 解题报告
    codeforces 463C. Gargari and Bishops 解题报告
    codeforces 463B Caisa and Pylons 解题报告
    codeforces 463A Caisa and Sugar 解题报告
    CSS3新的字体尺寸单位rem
    CSS中文字体对照表
    引用外部CSS的link和import方式的分析与比较
    CSS样式表引用方式
    10个CSS简写/优化技巧
  • 原文地址:https://www.cnblogs.com/Vampire6/p/11194007.html
Copyright © 2011-2022 走看看