The Magic Tower

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 0    Accepted Submission(s): 0

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
AC:
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{int a,b,c,a1,b1,c1;char s;int l,k;while(cin>>s>>a>>b>>c>>a1>>b1>>c1){l=b-c1;k=b1-c;if(s=='W'){while(1){if(l<=0){printf("Warrior loses\n");break;}else {a1=a1-l;if(a1<=0){printf("Warrior wins\n");break;}a=a-k;if(a<=0){printf("Warrior loses\n");break;}}}}else{while(1){if(l<=0){printf("Warrior loses\n");break;}else {a=a-k;if(a<=0){printf("Warrior loses\n");break;}a1=a1-l;if(a1<=0){printf("Warrior wins\n");break;}}}}}return 0;
}

The Magic Tower相关推荐

  1. Python游戏开发,Pygame模块,Python从零开始带大家实现一个魔塔小游戏

    开发工具 Python版本: 3.7.4 相关模块: pygame模块: 以及一些python自带的模块. 环境搭建 安装Python并添加到环境变量,pip安装需要的相关模块即可. 原理简介 首先, ...

  2. python3.7魔塔游戏_基于Funcode平台的“火锅版魔塔”游戏开发与设计

    2019 年第 2 期 信息与电脑 China Computer & Communication 软件开发与应用 基于 Funcode 平台的"火锅版魔塔"游戏开发与设计 ...

  3. HDU3698-Let the light guide us (线段树优化的dp)

    Plain of despair was once an ancient battlefield where those brave spirits had rested in peace for t ...

  4. 童年经典回忆 | 从零开始带大家用Python撸一个魔塔小游戏呀(1)

    相关文件 相关游戏素材(图片和音频等)源于网络,侵歉删. 需要源代码的小伙伴私信小编,或者关注小编的公众号[Python日志] 开发工具 Python版本:3.7.4 相关模块: pygame模块: ...

  5. Python游戏编程实践2:魔塔

    Python游戏编程实践2:魔塔 前言 运行 前言 在逗游游戏盒上玩了一个名叫<魔塔>的游戏,感觉颇有心得体会."与其临渊羡鱼,不如退而结网",使用Python语言编写 ...

  6. Hanoi Tower Troubles Again!

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1239 题目描述: Time Limit: 2 Seconds   ...

  7. 本周大新闻|传Meta与Magic Leap谈专利授权;PS VR2前6周出货60万台

    本周XR大新闻,AR方面,苹果XR项目核心高管曝光:传Meta与Magic Leap洽谈专利授权合作:歌尔光学公布新一代AR显示模组:Lumus公布二代波导Z-Lens最新细节:JBD X-cube发 ...

  8. Educational Codeforces Round 9 F. Magic Matrix 最小生成树

    F. Magic Matrix 题目连接: http://www.codeforces.com/contest/632/problem/F Description You're given a mat ...

  9. 我花了三个小时写了一道题的六千字题解....(POJ 2888 Magic Bracelet)

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 前置知识:小学生都能看懂的群论从入门到升天教程 <群论全家桶> 一道简单的题目 Probl ...

最新文章

  1. MacBook Air写代码真香!包邮送一台!
  2. 【转】ASP.NET中“字母和数字混合的验证码”详解
  3. MyCat好的博文收集
  4. [Leetcode][第79题][JAVA][单词搜索][DFS][回溯]
  5. Apache配置多个监听端口和访问网站的方法
  6. C++工作笔记-模版类要注意的地方(对比模版函数)
  7. 数据库清空表中的数据
  8. crontab 日志_Nginx日志切割并计划任务自动上传到FTP服务器
  9. [c++]筛法求素数
  10. Vue:vue将按需引入element抽成单独js文件
  11. (转)区块链创造了ICO,但是无法守护ICO
  12. 思科CDP/LLDP协议
  13. elementUI里面upload组件上传图片时选择图片之后不显示图片的问题,
  14. lehigh计算机就业,2016美国大学计算机专业排名
  15. 【2021CCF基线系统】基于飞桨实现系统认证风险预测-异常检测
  16. sql注入-简要SQL注入
  17. 在打工人的角度学《劳动法》
  18. 使用yum报错:You could try using --skip-broken to work around the problem
  19. matlab emi滤波器设计,基于Matlab-GUI的EMI滤波器设计
  20. 熟悉Elipse开发工具

热门文章

  1. Java Web Start入门基础教程
  2. [转载]HTTP协议详解
  3. 高度平衡树 -- AVL 树
  4. 阿里技术协会(ATA)11月系列精选文集
  5. 日志服务接入方式之Unity 3D篇
  6. Keepalived+HAProxy基于读写分离方式实现discuz论坛
  7. Entity Framework Extended Library (EF扩展类库,支持批量更新、删除、合并多个查询等)...
  8. [原]SDL开发教程
  9. 《How Tomcat Works》读书笔记(三)Connector
  10. who is the one who actually know the essential things in life?