首页 > 其他分享 >P6462 [传智杯 #2 决赛] 补刀 ----- 分类

P6462 [传智杯 #2 决赛] 补刀 ----- 分类

时间:2022-11-25 14:24:13浏览次数:48  
标签:传智杯 le YES 补刀 ----- 防御 100 include 小兵

题目描述

UIM 在写程序的空闲玩一款 MOBA 游戏。

当敌方的小兵进入到我方防御塔的范围内,就会持续受到防御塔造成的伤害;当然我方英雄也可以对它造成伤害。当小兵的血量降到了 0 或者更低,就会被击杀。为了获得经验,UIM 希望在防御塔将这个小兵杀死之前,亲自补刀将其击杀。

为了简化问题,我们假设这个小兵有 hh 点的生命值。每次防御塔的攻击可以给小兵造成 xx 点伤害,而你的英雄每次攻击可以给小兵造成 yy 点伤害。你的攻击速度和防御塔攻击速度相同,所以你可以在防御塔第一次攻击小兵之前,或者每次防御塔攻击之后,选择是否对小兵进行一次攻击,当然你也可以选择不攻击。

现在想知道,给出这些信息,判断英雄是否有办法将这个小兵击杀?

输入格式

每个测试点由多组数据组成。

输入第一行,包含一个正整数 TT,表示数据组数。

接下来 TT 行,每行三个非负整数 h,x,yh,x,y,其意义已经在题目描述中给出。

输出格式

输出 TT 行。对于每组数据,如果可以最后将小兵击杀,输出 Yes,否则输出 No

输入输出样例

输入 #1
5
100 100 1
100 97 1
100 98 1
100 99 1
100 100 0
输出 #1
No
No
Yes
Yes
No

说明/提示

数据的组数不多于 50,1\le h \le 10^{18}1≤h≤1018,0\le x,y \le 10^{18}0≤x,y≤1018。

#include <iostream>
#include<iomanip>
#include <math.h>
#include <vector>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include<stdio.h>
#include <unordered_map>
#include <utility>
//#include <bits/stdc++.h>
#define YES {cout << "Yes" << endl; continue; }
#define NO {cout << "No" << endl; continue; }

using namespace std; 
int main(){
    int T;
    long long h, x, y;
    cin >> T;
    while (T--) {
        cin >> h >> x >> y;
        if (y >= h) YES
        if (x >= h) NO
        if (y == 0) NO
        if (x == 0) YES
        long long hits = h / x + 1;
        long long rem = 0;
        rem = h % x == 0 ? x : h % x;
        if ((hits) * y >= rem) YES
        else NO
    }
}

 

标签:传智杯,le,YES,补刀,-----,防御,100,include,小兵
From: https://www.cnblogs.com/slowlydance2me/p/16924962.html

相关文章