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-playing play game), "The Magic Tower" are a game about how a warrior saves the Princ Ess.
After killing lots of monsters, the warrior has climbed to 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 for you and him if he can save the princess.
Input There are several test cases.
For each case, the the ' the ' a character, ' W ' or ' B ', indicating, who begins to attack, ' W ' for Warrior and "B" for boss. They attack each of the 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), Indi Cating 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), Indic Ating 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-a-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 1000 900 1000 900 B 100 1000 900 100 1000 900
Sample Output
Warrior wins Warrior loses
always looking at once space in a daze, those who say not separate friends, turn around, strangers. Familiar, quiet, quiet, left, left, unfamiliar, unfamiliar, disappeared, disappeared, strangers.
#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 to b The value of each attack if (w_b<0) w_b=0; B_w=b_atk-w_def;
B to w each attack value 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;
}
@ hold read "@☆ but beg" ❤ "Ann ★ Next time we do will be better ....
for what
this time the topic is in English .... Qaq ...