hdu 4950 打怪
http://acm.hdu.edu.cn/showproblem.php?pid=4950
给定怪兽血量h,你攻击力a,怪物回血力b,你攻击k次要休息一次,问能否杀死怪兽
特判一次打死怪兽的情况和第k次前打死怪兽的情况,否则只要能磨死怪兽即可
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <queue>
#include <vector>
#include<map>
#include <iostream>
#include <algorithm>
using namespace std;
#define RD(x) scanf("%d",&x)
#define RD2(x,y) scanf("%d%d",&x,&y)
#define clr0(x) memset(x,0,sizeof(x))
typedef long long LL; int main() {
LL h,a,b,k;
int cas = 1;
while(~scanf("%I64d%I64d%I64d%I64d",&h,&a,&b,&k),h|a|b|k){
printf("Case #%d: ",cas++);
if(a >= h || a*k-b*(k-1) >=h){
puts("YES");
continue;
}
if((k+1)*b < k*a){
puts("YES");
continue;
}
puts("NO");
}
return 0;
}
hdu 4950 打怪的更多相关文章
- HDU 4950 Monster(公式)
HDU 4950 Monster 题目链接 题意:给定怪兽血量h,你攻击力a.怪物回血力b,你攻击k次要歇息一次,问是否能杀死怪兽 思路:签到题,注意最后一下假设打死了怪,那么怪就不会回血了 思路: ...
- hdu 4950 Monster(数学题,多校8)
题目链接:pid=4950http://acm.hdu.edu.cn/showproblem.php?pid=4950">http://acm.hdu.edu.cn/showprobl ...
- HDU 4950 Monster
题目链接 题意:有一个怪物的血量为h,人攻击怪物,每回合可以杀掉a滴血,再回b滴血,k个回合之后人会休息一回合,即人不攻击而怪物回b滴血,问能否杀死.翻译过来就是给定一个数h,每轮可以先减a再加b,k ...
- HDU 4950 Monster (水题)
Monster 题目链接: http://acm.hust.edu.cn/vjudge/contest/123554#problem/I Description Teacher Mai has a k ...
- hdu 4950
#include<stdio.h> int main(){ __int64 h,a,b,k,j=0; while(scanf("%I64d%I64d%I64d%I64d" ...
- hdu 4044 树形DP 炮台打怪 (好题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4044 题目大意:给定n个节点组成的树,1为敌方基地,叶子结点为我方结点.我们可以在每个结点安放炮台,至 ...
- HDU 5968:异或密码(暴力)
http://acm.hdu.edu.cn/showproblem.php?pid=5968 题意:中文题意. 思路:一开始不会做,后来发现数据范围很小,而且那个数要是连续的,所以可能把所有情况枚举出 ...
- HDU 2159 二维费用背包问题
一个关于打怪升级的算法问题.. 题意:一个人在玩游戏老是要打怪升级,他愤怒了,现在,还差n经验升级,还有m的耐心度(为零就删游戏不玩了..),有m种怪,有一个最大的杀怪数s(杀超过m只也会删游戏的.. ...
- hdu 3954 线段树 (标记)
Level up Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
随机推荐
- Implementing On Item Click / Double Click for TListView
ListView.On Item Click & ListView.On Item Double Click To be able to locate the clicked (if ther ...
- Ansiable Manage MySQL global variables
mysql_variables - Manage MySQL global variables New in version 1.3. Synopsis Requirements (on host t ...
- conductor介绍
https://netflix.github.io/conductor/ https://github.com/Netflix/conductor 编译版: https://jcenter.bintr ...
- hibernate联合主键
@Entity @Table(name = "TABLE_NAME") @IdClass(PK.class) public class TableName implements S ...
- hdoj2859(矩阵DP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2859 思路: 第一次碰到这种矩阵上的DP题,想了半天也没想明白.本来想用子矩阵的左上角坐标和右下角坐标 ...
- codeblocks 更换颜色主题
关闭codeblocks,下载主题文件(colour_themes.conf).在关闭codeblocks的情况下,linux下的~/.config/codeblocks/下有个conf文件,将其备份 ...
- cdoj841-休生伤杜景死惊开 (逆序数变形)【线段树 树状数组】
http://acm.uestc.edu.cn/#/problem/show/841 休生伤杜景死惊开 Time Limit: 3000/1000MS (Java/Others) Memory ...
- spine
spine 英 [spʌɪn] 美 [spaɪn] n.脊柱;[动,植] 棘,刺(如刺猬和海胆的刺);鱼鳍的刺;植物上的刺
- 【c++】多层次继承类对象的构造函数参数的传递方法
#include <iostream.h> //基类CBase class CBase { int a; public: CBase(int na) { a=na; cout<< ...
- [leetcode]159. Longest Substring with At Most Two Distinct Characters至多包含两种字符的最长子串
Given a string s , find the length of the longest substring t that contains at most 2 distinct char ...