HDU计算机学院大学生程序设计竞赛(2015’12)The Magic Tower
Problem Description
After killing lots of monsters, the warrior has climbed up the top of the magic tower. There is a boss in front of him. The warrior must kill the boss to save the princess.
Now, the warrior wants you to tell him if he can save the princess.
For each case, the first line is a character, “W” or “B”, indicating that who begins to attack first, ”W” for warrior and ”B” for boss. They attack each other in turn.
The second line contains three integers, W_HP, W_ATK and W_DEF. (1<=W_HP<=10000, 0<=W_ATK, W_DEF<=65535), indicating warrior’s life point, attack value and defense value.
The third line contains three integers, B_HP, B_ATK and B_DEF. (1<=B_HP<=10000, 0<=B_ATK, B_DEF<=65535), indicating boss’s life point, attack value and defense value.
Note: warrior can make a damage of (W_ATK-B_DEF) to boss if (W_ATK-B_DEF) bigger than zero, otherwise no damage. Also, boss can make a damage of (B_ATK-W_DEF) to warrior if (B_ATK-W_DEF) bigger than zero, otherwise no damage.
#include<stdio.h>
//#include<bits/stdc++.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<sstream>
#include<set>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<limits.h>
#define inf 0x3fffffff
#define INF 0x3f3f3f3f
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define ULL unsigned long long
using namespace std;
int n;
int main ()
{
string s;
while(cin>>s)
{
int W_HP,W_ATK,W_DE;
int B_HP,B_ATK,B_DE; int F;
int D;
cin>>W_HP>>W_ATK>>W_DE;
cin>>B_HP>>B_ATK>>B_DE;
int CA=W_ATK-B_DE;
int CB=B_ATK-W_DE;
if(W_ATK<=B_DE)
{
puts("Warrior loses");
}
else if(B_ATK<=W_DE&&W_ATK>B_DE)
{
puts("Warrior wins");
}
else if(W_ATK>B_DE&&B_ATK>W_DE)
{
if(s[0]=='W')
{
int S_1=B_HP;
int S_2=W_HP;
while(S_1>0&&S_2>0)
{
S_1-=CA;
S_2-=CB;
}
if(S_1<=0)
{
puts("Warrior wins");
}
else if(S_2<=0&&S_1>0)
{
puts("Warrior loses");
}
}
else
{
int S_1=B_HP;
int S_2=W_HP;
while(S_1>0&&S_2>0)
{
S_2-=CB;
S_1-=CA;
}
if(S_2<=0)
{
puts("Warrior loses");
}
else if(S_2>0&&S_1<=0)
{
puts("Warrior wins");
}
}
}
}
return 0;
}
HDU计算机学院大学生程序设计竞赛(2015’12)The Magic Tower的更多相关文章
- hdu 计算机学院大学生程序设计竞赛(2015’11)
搬砖 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submissi ...
- HDU计算机学院大学生程序设计竞赛(2015’12)Happy Value
Problem Description In an apartment, there are N residents. The Internet Service Provider (ISP) want ...
- HDU计算机学院大学生程序设计竞赛(2015’12)The Country List
Problem Description As the 2010 World Expo hosted by Shanghai is coming, CC is very honorable to be ...
- 计算机学院大学生程序设计竞赛(2015’11)1005 ACM组队安排
1005 ACM组队安排 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Pro ...
- 计算机学院大学生程序设计竞赛(2015’12)Study Words
Study Words Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tota ...
- 计算机学院大学生程序设计竞赛(2015’12)Polygon
Polygon Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Su ...
- 计算机学院大学生程序设计竞赛(2015’12)The Country List
The Country List Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- 计算机学院大学生程序设计竞赛(2015’12) 1008 Study Words
#include<cstdio> #include<cstring> #include<map> #include<string> #include&l ...
- 计算机学院大学生程序设计竞赛(2015’12) 1009 The Magic Tower
#include<cmath> #include<cstdio> #include<cstring> #include<algorithm> using ...
随机推荐
- checked多选,取消,反选
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- MySQL存储引擎 -- MyISAM 与 InnoDB 实现
一.MyISAM索引实现MyISAM引擎使用B树作为索引结构,叶节点的data域存放的是数据记录的地址. MyISAM主键索引这里设表一共有三列,假设我们以Col1为主键,Col2为辅助索引.则下图是 ...
- oracle 常用set命令
SQL> set timing on; //设置显示“已用时间:XXXX”SQL> set autotrace on; //设置允许对执行的sql进行分析 ...
- IE双边距bug
标准参考 根据 W3C CSS2.1 规范中的描述,对于非替换的浮动元素,若 'margin-left' 或 'margin-right' 特性的计算值为 'auto',则它们的实际使用值为 '0'. ...
- CSS技巧: CSS隐藏文字的方法(CSS text-indent: -9999px;)
建站过过程中朋友喜欢把网站名称用H1表示,但从美观考虑,要用logo图片来代替h1,这时需要隐藏h1内的这段文字,但又不能对搜索引擎不友好,否则就失去了定义h1标签的意义. 在CSS中如何以图代字,找 ...
- vue 生命周期小结
生命周期小结生命周期钩子的一些使用方法: beforecreate : 可以在这加个loading事件,在加载实例时触发 created : 初始化完成时的事件写在这里,如在这结束loading事件, ...
- RowGame TopCoder - 10664
传送门 分析 首先不难想到O(k)做法,即dpi表示进行了几次,但复杂度明显爆炸,所以思考更优做法.我们发现数字个数很小,仅为可怜的50,所以从这里找突破口.我们发现每次可以在一个固定区域内进行刷分活 ...
- Bootstrap 的 ScrollSpy
一.简介 ScrollSpy 就是滚动监听.设置滚动监听方式有两种: 标签 API JavaScript 代码 监听区域也有两种可能: body 标签 自定义标签元素 {注意} ScrollSpy 需 ...
- 【转】链接任意目录下库文件(解决错误“/usr/bin/ld: cannot find -lxxx”
netbeans构建项目也出现了同样的问题.猜测是netbeans内部就用的是-l 这种编译方式,所以需要把***.a手动改为lib***.a 原文地址:链接任意目录下库文件(解决错误“/usr/bi ...
- [raspberry pi3] zram设置
linux 3.15之后添加了个和mac一样的功能,内存压缩zram, 之前还有个zswap, zram通常是以模块的方式被放在系统里面的,以便在可以根据需求的不同,定制化加载. raspberry ...