2015'12 항저우전교전 1009 The Magic Tower(물문제 빨리 올려!)
문제 풀이:
수제
코드
#include <bits/stdc++.h>
#include <cstdio>
#include <queue>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <ctime>
#include <cmath>
#include <cctype>
#include <string>
#include <bitset>
#define MAX 100000
#define LL long long
using namespace std;
int cas=1,T,w1,w2,w3,b1,b2,b3;
char op[2];
int main()
{
while(scanf("%s",op)!=EOF )
{
scanf("%d%d%d",&w1,&w2,&w3);
scanf("%d%d%d",&b1,&b2,&b3);
w2-=b3;b2-=w3;
if(w2<=0)
{
printf("Warrior loses
");
continue;
}
if(b2<=0)
{
printf("Warrior wins
");
continue;
}
int wt,bt;
wt=b1/w2+(b1%w2?1:0);
bt=w1/b2+(w1%b2?1:0);
if(op[0]=='W')
{
if(wt<=bt)
printf("Warrior wins
");
else
printf("Warrior loses
");
}
else
{
if(bt<=wt)
printf("Warrior loses
");
else
printf("Warrior wins
");
}
}
return 0;
}
제목.
The Magic Tower
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2475 Accepted Submission(s): 642
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
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.