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. 手机淘宝中的那些Web技术-使用了类似PhoneGap的实现

    Native APP与Web APP的技术融合已经逐渐成为一种趋势,使用标准的Web技术来开发应用中的某些功能,不仅可以降低开发成本,同时还可以方便的进行功能迭代更新.但是如何保证Web APP的流畅 ...

  2. mysql 使用sqldump来进行数据库还原

    MYSQLdump参数详解 mysqldump备份: 复制代码代码如下: mysqldump -u用户名 -p密码 -h主机 数据库 a -w “sql条件” –lock-all-tables > ...

  3. Javascript数据类型共有六种

    Javascript数据类型共有六种 /* var box; alert(typeof box); // box是Undefined类型,值是undefined,类型返回的字符串是undefined ...

  4. Winform ListView的用法

    清除数据: lvOrder.Items.Clear(); 赋值数据: if (lvList.Count != 0) { foreach (var item in lvList) { string[] ...

  5. 初识JSON

    ▓▓▓▓▓▓ 大致介绍 JSON(JavaScript Object Notation  JavaScript对象表示法),JSON是一种数据格式,不是一种编程语言.虽然它的名字中有JavaScrip ...

  6. jQuery 判断checkbox是否被选中 4种方法

    下午写JS验证,有一个需求需要判断 checkbox是否被选择,查阅相关资料后,总结以下4种方法,分享给大家. <!DOCTYPE html> <html lang="en ...

  7. 对lua中_ENV表的理解(lua5.2版本以后)

    当我拿到_ENV表的时候,会去想这个_ENV表是干什么用的? 首先看如下代码: print(_ENV) --0x1d005f0 print(_G) --0x1d005f0 ViewCode 看了上面的 ...

  8. .NET操作RabbitMQ组件EasyNetQ使用中文简版文档。

    本文出自EasyNetQ官方文档,内容为自己理解加翻译.文档地址:https://github.com/EasyNetQ/EasyNetQ/wiki/Quick-Start EasyNetQ简介 Ea ...

  9. 自己开发轻量级ORM(二)

    上一篇简单的对轻量级ORM开发开了个头.这篇主要聊下ORM框架的设计思路. ORM本质上是对数据库操作的抽象.大体上我将其分为对数据结构的抽象和对执行方法的抽象. 我的ORM设计图: ORM框架需要完 ...

  10. Python 黑帽编程 4.2 Sniffer之数据本地存储和加载

    在上一节,我们完成了编写一个简易的Sniffer的第一步--数据捕获. 很多时候,我们需要将捕获的数据先保存到磁盘上,之后再使用工具或者自己编写代码来进行详细分析. 本节我们在上一节的基础上来讲解保存 ...