The Magic Tower

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 2382    Accepted Submission(s): 615

Problem Description
Like most of the RPG (role play game), “The Magic Tower” is a game about how a warrior saves the princess. 

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.
 
Input
There are several test cases.

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. 
 
Output
For each case, if boss’s HP first turns to be smaller or equal than zero, please print ”Warrior wins”. Otherwise, please print “Warrior loses”. If warrior cannot kill the boss forever, please also print ”Warrior loses”.
 
Sample Input
W
100 1000 900
100 1000 900
B
100 1000 900
100 1000 900
 
Sample Output
Warrior wins
Warrior loses
 

总是望着曾经的空间发呆,那些说好不分开的朋友不在了,转身,陌路。 熟悉的,安静了, 安静的,离开了, 离开的,陌生了, 陌生的,消失了, 消失的,陌路了。



#include <stdio.h>
#include <stdlib.h>
int main()
{
char a;
int i,W_HP,W_ATK,W_DEF,B_HP,B_ATK,B_DEF,w_b,b_w;
while(~scanf("%c",&a))
{
scanf("%d%d%d%d%d%d%*c",&W_HP,&W_ATK,&W_DEF,&B_HP,&B_ATK,&B_DEF);
w_b=W_ATK-B_DEF; //w对b每一次攻击的数值
if(w_b<0) w_b=0;
b_w=B_ATK-W_DEF; //b对w每一次攻击的数值
if(b_w<0) b_w=0;
if(a=='W')
{
for(i=1;i>=1;i++)
{
if(w_b==0)
{
printf("Warrior loses\n");
break;
}
B_HP-=w_b;
if(B_HP<0)
{
printf("Warrior wins\n");
break;
}
W_HP-=b_w;
if(W_HP<0)
{
printf("Warrior loses\n");
break;
}
}
}
if(a=='B')
{
for(i=1;i>=1;i++)
{
if(w_b==0)
{
printf("Warrior loses\n");
break;
}
W_HP-=b_w;
if(W_HP<0)
{
printf("Warrior loses\n");
break;
}
B_HP-=w_b;
if(B_HP<0)
{
printf("Warrior wins\n");
break;
}
}
}
}
return 0;
}

@执念  "@☆但求“❤”安★
下次我们做的一定会更好。。。。




为什么这次的题目是英文的。。。。QAQ...

计算机学院大学生程序设计竞赛(2015’12)The Magic Tower的更多相关文章

  1. hdu 计算机学院大学生程序设计竞赛(2015’11)

    搬砖 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submissi ...

  2. 计算机学院大学生程序设计竞赛(2015’11)1005 ACM组队安排

    1005 ACM组队安排 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Pro ...

  3. 计算机学院大学生程序设计竞赛(2015’12)Study Words

    Study Words Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Tota ...

  4. 计算机学院大学生程序设计竞赛(2015’12)Polygon

    Polygon Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Su ...

  5. 计算机学院大学生程序设计竞赛(2015’12)The Country List

    The Country List Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  6. 计算机学院大学生程序设计竞赛(2015’12) 1008 Study Words

    #include<cstdio> #include<cstring> #include<map> #include<string> #include&l ...

  7. 计算机学院大学生程序设计竞赛(2015’12) 1009 The Magic Tower

    #include<cmath> #include<cstdio> #include<cstring> #include<algorithm> using ...

  8. 计算机学院大学生程序设计竞赛(2015’12) 1006 01 Matrix

    #include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> ...

  9. 计算机学院大学生程序设计竞赛(2015’12) 1003 The collector’s puzzle

    #include<cstdio> #include<algorithm> using namespace std; using namespace std; +; int a[ ...

  10. 计算机学院大学生程序设计竞赛(2015’12) 1004 Happy Value

    #include<cstdio> #include<cstring> #include<cmath> #include<vector> #include ...

随机推荐

  1. dos中定义变量与获取常见的引用变量以及四则运算、备份文件(set用法)

    在dos中使用set定义变量: set  a=8              (注意等号两边没有空格) 引用变量如: echo  %a%        将打印a的值 (%a%是获取变量a的值) dos中 ...

  2. POJ 3104 Drying [二分 有坑点 好题]

    传送门 表示又是神题一道 Drying Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9327   Accepted: 23 ...

  3. Android网络编程之HttpClient运用

    Android网络编程之HttpClient运用 在 Android开发中我们经常会用到网络连接功能与服务器进行数据的交互,为此Android的SDK提供了Apache的HttpClient来方便我们 ...

  4. druid 的应用(密码加密),logback的应用

    参考博客:https://github.com/yjmyzz/spring-mybatis-multidatasourcehttp://www.cnblogs.com/dream-to-pku/p/6 ...

  5. Day 1 计算机基础

    计算机基础 一.为什么学习计算机基础? 编程语言的作用:人类使机器明白并动作的指令.类似:人文社会的英语.   关系:计算机硬件 —— 操作系统(OS) —— 软件(编程语言成品,学习成果). 自语: ...

  6. PAT (Advanced Level) 1086. Tree Traversals Again (25)

    入栈顺序为先序遍历,出栈顺序为中序遍历. #include<cstdio> #include<cstring> #include<cmath> #include&l ...

  7. disruptor 核心链路应用场景

    核心链路一般比较复杂并且需要考虑:服务之间相互依赖性.流程能够走完.人员的变动等情况 要考虑:兜底.补偿. 常见解决方案是:1)完全解耦 2)模板模式 其他解决方案:1)有限状态机框架:spring- ...

  8. Java代码规范和质量检查插件-Checkstyle(官方资源)

    其实Checkstyle是一个JAR包,然后第三方开发者开发了Eclipse/IDEA的插件. 官网: https://github.com/checkstyle/checkstyle Eclipse ...

  9. JavaScript 函数作用域的“提升”现象

    在JavaScript当中,定义变量通过var操作符+变量名.但是不加 var 操作符,直接赋值也是可以的.例如 : message = "hello JavaScript ! " ...

  10. C#如何设置控件水平对齐,垂直对齐

    如果要设置一些控件垂直对齐,点击这个按钮 如果要设置水平对齐,则点击这个按钮,选中控件之后点击左对齐(多个按钮都试下吧,总归能对齐到你要的效果的)