• bzoj3856 Monster


    Description

    Teacher Mai has a kingdom. A monster has invaded this kingdom, and Teacher Mai wants to kill it.
     
    Monster initially has h HP. And it will die if HP is less than 1.
     
    Teacher Mai and monster take turns to do their action. In one round, Teacher Mai can attack the monster so that the HP of the monster will be reduced by a. At the end of this round, the HP of monster will be increased by b.
     
    After k consecutive round's attack, Teacher Mai must take a rest in this round. However, he can also choose to take a rest in any round.
     
    Output "YES" if Teacher Mai can kill this monster, else output "NO".

    Input

    There are multiple test cases, terminated by a line "0 0 0 0".
     
    For each test case, the first line contains four integers h,a,b,k(1<=h,a,b,k <=10^9).

    Output

    For each case, output "Case #k: " first, where k is the case number counting from 1. Then output "YES" if Teacher Mai can kill this monster, else output "NO".

    Sample Input

    5 3 2 2
    0 0 0 0

    Sample Output

    Case #1: NO
     
    真的好那啥的一道题……
    一个人打怪,怪有h滴血,每个回合人打怪造成a伤害,然后怪会回复b的血量。每k回合人要休息一次,然后怪还能继续回血。问人能不能打死怪
    只要判断第k回合人能不能打死怪,判断人在k回合里造成的伤害是不是比怪在k+1回合里回的血多就好了
    #include<cstdio>
    #include<iostream>
    using namespace std;
    #define LL long long
    LL h,a,b,k;
    int tt;
    int main()
    {
        while(scanf("%lld%lld%lld%lld",&h,&a,&b,&k)&&h&&a&&b&&k)
        {
            tt++;printf("Case #%d: ",tt);
            if(h<=(a+max(0ll,(k-1)*(a-b))))printf("YES
    ");
            else if(k*a>(k+1)*b)printf("YES
    ");
            else printf("NO
    ");
        }
    }
    
    ——by zhber,转载请注明来源
  • 相关阅读:
    吴恩达读书笔记【5】-流水线与端到端
    标准与扩展ACL 、 命名ACL
    VLAN间通讯 、 动态路由RIP
    HSRP热备份路由协议 、 STP生成树协议
    VLAN广播域划分
    应用层
    包格式及IP地址 、 网络层协议及设备
    传输层 、 应用层
    数据链路层解析 、 交换机基本配置
    网络基础3
  • 原文地址:https://www.cnblogs.com/zhber/p/4257163.html
Copyright © 2020-2023  润新知