The Magic Tower
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2398 Accepted Submission(s): 618
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.
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.
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 <iostream> #include <cstring> #include <cstdio> #include <cstdlib> #include <cmath> #include <algorithm> #include <queue> #include <stack> #include <set> #include <map> #include <list> #define LL long long #define INF 0x3f3f3f3f using namespace std; int main() { char ch; int a1,b1,c1; int a2,b2,c2; while(cin>>ch) { cin>>a1>>b1>>c1; cin>>a2>>b2>>c2; if(c2 - b1 >= 0) cout<<"Warrior loses"<<endl; else { if(c1 - b2 >= 0) cout<<"Warrior wins"<<endl; else { if(ch == 'W') { while(1) { a2 -= b1; if(a2 <= 0) { cout<<"Warrior wins"<<endl; break; } a1 -= b2; if(a1 <= 0) { cout<<"Warrior loses"<<endl; break; } } } else { while(1) { a1 -= b2; if(a1 <= 0) { cout<<"Warrior loses"<<endl; break; } a2 -= b1; if(a2 <= 0) { cout<<"Warrior wins"<<endl; break; } } } } } } return 0; }

本文深入探讨了游戏开发领域的关键技术,包括游戏引擎、编程语言、硬件优化等,并重点介绍了AI音视频处理在游戏中的应用,如语音识别、图像处理、AR特效等。同时,文章还涉及了自动化测试、性能优化等现代开发流程,旨在为游戏开发者提供全面的技术指导。
6万+

被折叠的 条评论
为什么被折叠?



