记录编号 229262 评测结果 AAAAAAAAAA
题目名称 杀手游戏 最终得分 100
用户昵称 Gravatar哒哒哒哒哒! 是否通过 通过
代码语言 C++ 运行时间 0.025 s
提交时间 2016-02-20 07:44:14 内存使用 0.32 MiB
显示代码纯文本
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>

using namespace std;

struct Palyer{
	int Blood;//血 
	int Pai; //牌数 
	int Bang;//杀 
	int Grenade;//  出闪
	int Ghost;//出杀
	int Knife;//掉血
	int Miss;//防御
	int Parry;//防御并且摸牌
	void clear(){
		Bang=Pai=Grenade=Ghost=Knife=Miss=Parry=0;
		Blood=4;
	}
}Peo[2]; 
char pai[8];
int mopaifang=0;

inline void Mopai();
inline int Get(int);
inline void Chupai();
inline void Bang();
inline void Grenade();
inline void Ghost();
inline void Knife();
inline void Miss(int);
inline void Parry(int);
inline void Throw();

inline void Bang()
{
	int duifang=!mopaifang;
	Peo[mopaifang].Bang--;
	Peo[mopaifang].Pai--;
	if(Peo[duifang].Parry!=0) Parry(duifang);
	else{
		if(Peo[duifang].Miss!=0) Miss(duifang);
		else Peo[duifang].Blood--;
	}
	return;
}
inline void Grenade()
{
	int duifang=!mopaifang;
	Peo[mopaifang].Grenade--;
	Peo[mopaifang].Pai--;
	if(Peo[duifang].Parry!=0) Parry(duifang);
	else{
		if(Peo[duifang].Miss!=0) Miss(duifang);
		else Peo[duifang].Blood--;
	}
	return;
}
inline void Ghost()
{
	int duifang=!mopaifang;
	Peo[mopaifang].Ghost--;
	Peo[mopaifang].Pai--;
	if(Peo[duifang].Bang!=0){
		Peo[duifang].Bang--;
		Peo[duifang].Pai--;
	}
	else Peo[duifang].Blood--;
	return;
}
inline void Knife()
{
	int duifang=!mopaifang;
	Peo[mopaifang].Knife--;
	Peo[mopaifang].Pai--;
	Peo[duifang].Blood--;
	return;
}
inline void Miss(int x)
{
	Peo[x].Miss--;
	Peo[x].Pai--;
	return;
}
inline void Parry(int x)
{
	Peo[x].Parry--;
	Peo[x].Pai--;
	Get(x);
	return;
}
inline void Throw()
{
	while(Peo[mopaifang].Pai>Peo[mopaifang].Blood){
		if(Peo[mopaifang].Bang!=0){
			Peo[mopaifang].Bang--;
			Peo[mopaifang].Pai--;
		}
		else if(Peo[mopaifang].Miss!=0){
			Peo[mopaifang].Miss--;
			Peo[mopaifang].Pai--;
		}
		else {
			Peo[mopaifang].Parry--;
			Peo[mopaifang].Pai--;
		}
	}
}
inline void Chupai()
{
	while(Peo[mopaifang].Ghost!=0) Ghost();
	while(Peo[mopaifang].Knife!=0) Knife();
	while(Peo[mopaifang].Grenade!=0) Grenade();
	if(Peo[mopaifang].Bang!=0) Bang();
	if(Peo[mopaifang].Pai>Peo[mopaifang].Blood) Throw();
	mopaifang=!mopaifang;
}
inline void Mopai()
{
	for(int i=1;i<=2;i++)	Get(mopaifang);
}
inline int Get(int mopaifang)
{
	scanf("%s",pai);
	if(pai[0]=='.')	return 1;
	if(pai[0]=='B') Peo[mopaifang].Bang++;
	else if(pai[0]=='G'&&pai[1]=='r')Peo[mopaifang].Grenade++;
	else if(pai[0]=='G'&&pai[1]=='h')Peo[mopaifang].Ghost++;
	else if(pai[0]=='K')Peo[mopaifang].Knife++;
	else if(pai[0]=='M')Peo[mopaifang].Miss++;
	else if(pai[0]=='P')Peo[mopaifang].Parry++;
	Peo[mopaifang].Pai++;
	return 0;
}
int main()
{
	freopen("bang.in","r",stdin);
	freopen("bang.out","w",stdout);
	while(1){
		Peo[0].clear();
		Peo[1].clear();
		mopaifang=0;
/*发牌*/for(int i=1;i<=4;i++)	if( Get(mopaifang) )	return 0;
		mopaifang=!mopaifang;
/*结束*/for(int i=1;i<=4;i++)	Get(mopaifang);
		mopaifang=!mopaifang;		
		while(1){		
			Mopai();
			Chupai();
			if(Peo[0].Blood<=0){
				printf("LOSE\n");
				scanf("%s",pai);
				while(pai[0]!='=') scanf("%s",pai);
				break;
			}
			if(Peo[1].Blood<=0){
				printf("WIN\n");
				scanf("%s",pai);
				while(pai[0]!='=') scanf("%s",pai);
				break;
			}		
		}	
	}
	return 0;
}