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 ...
随机推荐
- Developer tools
20. Developer tools Spring Boot includes an additional set of tools that can make the application de ...
- liunx环境,摄像头无法识别,解决方案
今天无语了,linux14.04系统下,使用罗技c270摄像头.发现插上没有反应,系统版本: lenovo-myc@lenovomyc-Lenovo-Product:~/Downloads$ unam ...
- ListView---复杂的listview显示
1 . 初始化数据 private void fillData() { ll_loading.setVisibility(View.VISIBLE); // 显示进度 new Thread() { p ...
- java线程的三种实现方式
线程实现的三种种方式: 一个是继承Thread类,实现run()方法: 一个是实现Runnable接口,实现run()方法: 一个是实现Callable接口,实现call()方法:该方式和实现Runn ...
- C/C++读写csv文件
博客转载自:http://blog.csdn.net/u012234115/article/details/64465398 C++ 读写CSV文件,注意一下格式即可 #include <ios ...
- IntelliJ Idea 免费激活方法
文章介绍 文章不错,指的研究一下,idea的联网激活确实有可行性,但是上有政策,下有对策,如何才能保护版权,是一个值得深思的问题. 文章属于转载,文末有文章来源,转载注明出处. 1 激活码激活 到网站 ...
- springcloud 定义切面实现对请求操作记录日志,方便后面分析接口详情
package com.idoipo.infras.gateway.open.config; import com.alibaba.fastjson.JSON; import com.alibaba. ...
- [raspberry pi3] opensuse使用splash中问题处理
问题一: QXcbConnection: Could not connect to display :1594410864 解决方案: export QT_QPA_PLATFORM=offscreen
- mac port选择使用的python的版本
To list: port select --list python To show: port select --show python To select: sudo port select -- ...
- DotNetty 版 mqtt 开源客户端 (MqttFx)
一.DotNetty背景介绍 某天发现 dotnet 是个好东西,就找了个项目来练练手.于是有了本文的 Mqtt 客户端 (github: MqttFx ) DotNetty是微软的Azure ...