hdu4950 Monster (水题)
| 4950 | Monster |
MonsterTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem Description
Teacher Mai has a kingdom. A monster has invaded this
kingdom, and Teacher Mai wants to kill it. Monster initially has h HP. Teacher Mai and monster take turns After k consecutive round's attack, Output "YES" if Teacher Mai can kill this monster, Input
There are multiple test cases, terminated by a line "0
0 0 0". For each test case, the first line contains four integers 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
Source
Recommend
hujie
|
2014多校8 第六题 1006
大意:主角打boss,boss有h血,每回合主角打a血,然后boss回b血。主角打k回合后需要休息1回合,boss也回血。问主角能否打死boss。
题解:
惊天大水题。不过一开始一大堆人wa,我还怕了好久。认真分析,其实是很容易1A的。
我们分3种情况:
1.一刀砍死:
h-a < 1
2.连砍k刀将其砍死:
h-(a-b)*(k-1)-a < 1
3.连砍k刀之后休息一回合,怪的血量减少
h-(a-b)*(k)+b < h
这三种情况就是全部了,其中任意一个为true,就能砍死怪。
题目说可以在没砍到k刀就停下来休息,其实是不优的,要不就一刀砍死,要不就连砍k刀再休息,要是砍不到k刀就休息还能削弱怪物的血,连砍k刀肯定更能削弱怪物的血,这个情况归类到情况3中。
实在是太水了,居然只问yes和no,至少也问一下多少回合砍死啊!
代码:
//#pragma comment(linker, "/STACK:102400000,102400000")
#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
using namespace std;
#define ll long long
#define usint unsigned int
#define mz(array) memset(array, 0, sizeof(array))
#define minf(array) memset(array, 0x3f, sizeof(array))
#define REP(i,n) for(i=0;i<(n);i++)
#define FOR(i,x,n) for(i=(x);i<=(n);i++)
#define RD(x) scanf("%d",&x)
#define RD2(x,y) scanf("%d%d",&x,&y)
#define RD3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define WN(x) printf("%d\n",x);
#define RE freopen("D.in","r",stdin)
#define WE freopen("1biao.out","w",stdout) int main() {
int cas=, ans;
ll h,a,b,k;
while(scanf("%I64d%I64d%I64d%I64d",&h,&a,&b,&k)!=EOF) {
if(h== && a== && b== && k==)break;
if(h-a<)ans=;
else if(h-(a-b)*(k-)-a<)ans=;
else {
if(h-(a-b)*(k)+b>=h)ans=;
else ans=;
}
if(ans==)printf("Case #%d: NO\n",cas++);
else printf("Case #%d: YES\n",cas++);
}
return ;
}
hdu4950 Monster (水题)的更多相关文章
- HDU 4950 Monster (水题)
Monster 题目链接: http://acm.hust.edu.cn/vjudge/contest/123554#problem/I Description Teacher Mai has a k ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- ACM :漫漫上学路 -DP -水题
CSU 1772 漫漫上学路 Time Limit: 1000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)
1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 154 Solved: 112[ ...
- [poj2247] Humble Numbers (DP水题)
DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...
- gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,
1195: 相信我这是水题 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 821 Solved: 219 Description GDUT中有个风云人 ...
- BZOJ 1303 CQOI2009 中位数图 水题
1303: [CQOI2009]中位数图 Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2340 Solved: 1464[Submit][Statu ...
- 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题
B - 大还是小? Time Limit:5000MS Memory Limit:65535KB 64bit IO Format: Description 输入两个实数,判断第一个数大 ...
- ACM水题
ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...
- CF451C Predict Outcome of the Game 水题
Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...
随机推荐
- struts2 CVE-2013-4316 S2-019 Dynamic method executions Vul
catalog . Description . Effected Scope . Exploit Analysis . Principle Of Vulnerability . Patch Fix 1 ...
- Joblogs——ContentValues的使用
ContentValues在Android的SQLiteDatabase.update (String table, ContentValues values, String whereClause, ...
- 解析window.open链接的参数
); var arr = new Array(); arr = str.split("&"); ){ ; i<arr.length; i++){ ){ ); if(p ...
- C#获取文件的Md5值
private string GetMd5(Stream fileStream) { MD5CryptoServiceProvider md5P ...
- A.Kaw矩阵代数初步学习笔记 1. Introduction
“矩阵代数初步”(Introduction to MATRIX ALGEBRA)课程由Prof. A.K.Kaw(University of South Florida)设计并讲授. PDF格式学习笔 ...
- Python翻转字符串或者列表的方式
1. reversed class reversed(object) | reversed(sequence) -> reverse iterator over values of the se ...
- Django中Celery的实现介绍(一)
Django中Celery的实现 Celery官网http://www.celeryproject.org/ 学习资料:http://docs.jinkan.org/docs/celery/ Cele ...
- js003-基本概念
js003-基本概念 3.1 语法 3.1.1 区分大小写 ECMAScript中的一切(变量.函数名和操作符)都是区分大小写的,并且不能用关键字作为函数名:如 typeof. 3.1.2 标识符 所 ...
- WinForm------如何将GridControl数据导出到Excel
转载: http://www.cnblogs.com/xiaofengfeng/archive/2011/11/22/2258906.html 代码: SaveFileDialog saveFileD ...
- 9月13日JavaScript语句循环(100以备奇偶数、100以内与7先关的数、100以内整数的和、10以内阶乘、乘法口诀、篮球弹起高度、64格子放东西)
3.循环 循环是操作某一个功能(执行某段代码). ①循环四要素: a 循环初始值 b 循环的条件 c 循环状态 d 循环体 ②for循环 a 穷举:把所有的可能性的都一一列出来. b 迭代:每次循环都 ...