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

时间:2022-04-17 08:46:52
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std; int whp,wat,wdef,bhp,bat,bdef;
char s; int main()
{
while(~scanf("%c",&s))
{
scanf("%d%d%d",&whp,&wat,&wdef);
scanf("%d%d%d",&bhp,&bat,&bdef);
int t1=wat-bdef;
int t2=bat-wdef; if(s=='W')
{
while()
{
if(t1>) bhp-=t1;
if(bhp<=)
{
printf("Warrior wins\n");
break;
} if(t2>) whp-=t2;
if(whp<=)
{
printf("Warrior loses\n");
break;
} if(t1<=)
{
printf("Warrior loses\n");
break;
}
}
}
else if(s=='B')
{
while()
{
if(t2>) whp-=t2;
if(whp<=)
{
printf("Warrior loses\n");
break;
} if(t1>) bhp-=t1;
if(bhp<=)
{
printf("Warrior wins\n");
break;
} if(t1<=)
{
printf("Warrior loses\n");
break;
}
}
}
}
return ;
}