3856: Monster

Time Limit: 1 Sec  Memory Limit: 64 MB
Submit: 351  Solved: 161
[Submit][Status][Discuss]

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

HINT

 

Source

By 镇海中学

题解:其实,这是一道水题——事实上,的确是道水题——但是,但是——很明显此题很容易WA掉= =

想干掉这个怪,必须要满足三个条件之一——1.可以一击必杀  2.在休息之前可以干掉这个怪 3.每次进行了一个K长度的周期后这个怪的总体血量在下降

(PS:想起来满是童年口袋妖怪的影子啊,但我居然还是WA掉了2次= =)

 /**************************************************************
Problem:
User: HansBug
Language: Pascal
Result: Accepted
Time: ms
Memory: kb
****************************************************************/ var
i,j,k,l,m,n:int64;
begin
while not(eof) do
begin
readln(i,j,k,l);inc(m);
if (i=) and (j=) and (k=) and (l=) then exit;
write('Case #',m,': ');
if (j>=i) or ((l*j-(l-)*k)>=i) or ((l*j)>((l+)*k)) then writeln('YES') else writeln('NO');
end;
end.

3856: Monster的更多相关文章

  1. BZOJ 3856: Monster【杂题】

    Description Teacher Mai has a kingdom. A monster has invaded this kingdom, and Teacher Mai wants to ...

  2. bzoj 刷水

    bzoj 3856: Monster 虽然是sb题,,但是要注意h可能<=a,,,开始忘记判了WA得很开心. #include <iostream> #include <cst ...

  3. bzoj AC倒序

    Search GO 说明:输入题号直接进入相应题目,如需搜索含数字的题目,请在关键词前加单引号 Problem ID Title Source AC Submit Y 1000 A+B Problem ...

  4. 【BZOJ】【3856】Monster

    又是一道水题…… 重点是分情况讨论: 首先我们很容易想到,如果a*k-b*(k+1)>0的话那么一定能磨死Monster. 但即使不满足这个条件,还有可能打死boss: 1.h-a<1也就 ...

  5. hdu4950 Monster (水题)

    4950 Monster Monster Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others ...

  6. codeforces 487A A. Fight the Monster(二分)

    题目链接: A. Fight the Monster time limit per test 1 second memory limit per test 256 megabytes input st ...

  7. BZOJ3856: Monster

    题目:http://www.lydsy.com/JudgeOnline/problem.php?id=3856 题解:怎么乱搞一下都可以把 代码: #include<cstdio> #in ...

  8. HDU 4950 Monster (水题)

    Monster 题目链接: http://acm.hust.edu.cn/vjudge/contest/123554#problem/I Description Teacher Mai has a k ...

  9. Codeforces Round #278 (Div. 1) A. Fight the Monster 暴力

    A. Fight the Monster Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/487/ ...

随机推荐

  1. linux学习笔记----文件与目录管理

    一.目录处理命令 cd:切换目录 pwd:显示当前目录 mkdir:新建一个新的目录 rmdir:删除一个空的目录 1)pwd:显示当前目录 pwd [-P] P:显示出当前的路径,而非使用连接(li ...

  2. java配置环境变量-及原因

    为什么java要配置环境变量? 那就要从java的编译和解析过程说起 java文件的编译和解析过程 一.一个hellow.java文件,要经历先编译(变成hellow.class),再解析(解析成机器 ...

  3. Ajax.BeginForm()知多少

    在ASP.NET MVC中,Ajax.BeginForm扮演着异步提交的重要角色.其中就有五个重载方法,但是在实际应用中,你未必使用的得心应手,今天我们就从主要的参数来一探究竟. 一.actionNa ...

  4. 使用Grafana 展示Docker容器的监控图表并设置邮件报警规则

    一.Docker 容器监控报警方式 接着上篇文章的记录,看到grafana的版本已经更新到4.2了,并且在4.0以后的版本中,加入了Alert Notifications 功能,这样在对容器 监控完, ...

  5. PariticalFilter在MFC上的运行,源代码公开

    由于项目需要,进行过一段时间的 PariticalFilter 研究.主要的工作就是将网络上的Console代码和Mfc融合在一起,并且添加了Mfc端的控制功能.       程序还有不完善的地方,现 ...

  6. linux的Make使用的重定向

    Linux中,脚本语言环境中,即你用make xxx即其他一些普通linux命令,比如ls,find等,不同的数字,代表不同的含义:  数字 含义  标准叫法   0  标准输入   stdin = ...

  7. 字符集编码与Python(二)Unicode与utf-8

    Python中的Unicode和utf-8 上一篇提过了字符集的历史其中简单的讲解了Unicode与utf-8的关系,简单的总结一下:   utf-8和utf-16 .utf-32是一类,实现的功能是 ...

  8. 编写JQuery插件-3

    该了解我们也知道的差不多了,接下来编写我们第一个jq插件吧 封装对象方法的插件 我们编写一个设置和获取颜色的插件,我们需要实现两个功能 1.设置匹配元素的颜色 2.获取匹配元素(元素集合的第一个)的颜 ...

  9. viewpager翻页的窗帘效果动画

    前端时间比较忙,好长时间没有更新微博,就工作中出现的部分问题,与大家分享一下. 大家都知道viewpager在android开发中是运用率比较高的控件,现在就其窗帘下过的动画分享. 文章出处:http ...

  10. UI进阶 即时通讯之XMPP好友列表、添加好友、获取会话内容、简单聊天

    这篇博客的代码是直接在上篇博客的基础上增加的,先给出部分代码,最后会给出能实现简单功能的完整代码. UI进阶 即时通讯之XMPP登录.注册 1.好友列表 初始化好友花名册 #pragma mark - ...