前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >3856: Monster

3856: Monster

作者头像
HansBug
发布2018-04-11 10:46:19
5580
发布2018-04-11 10:46:19
举报
文章被收录于专栏:HansBug's Lab

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次= =)

代码语言:javascript
复制
 1 /**************************************************************
 2     Problem: 3856
 3     User: HansBug
 4     Language: Pascal
 5     Result: Accepted
 6     Time:4 ms
 7     Memory:224 kb
 8 ****************************************************************/
 9  
10 var
11    i,j,k,l,m,n:int64;
12 begin
13      while not(eof) do
14            begin
15                 readln(i,j,k,l);inc(m);
16                 if (i=0) and (j=0) and (k=0) and (l=0) then exit;
17                 write('Case #',m,': ');
18                 if (j>=i) or ((l*j-(l-1)*k)>=i) or ((l*j)>((l+1)*k)) then writeln('YES') else writeln('NO');
19            end;
20 end.
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2015-05-07 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 3856: Monster
  • Description
  • Input
  • Output
  • Sample Input
  • Sample Output
  • HINT
  • Source
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档