JiaoZhu and SC | ||||||
| ||||||
Description | ||||||
自从电子竞技在中国被认定为第99个正式体育项目,教主就投身其中,SC(StarCraft 星际争霸)他拿手的一款游戏,当然也有很多职业选手参与其中。 | ||||||
Input | ||||||
本题只有一组测试数据 | ||||||
Output | ||||||
对于每场比赛: | ||||||
Sample Input | ||||||
4 4 JiaoZhu T Jaedong Z Chadalt T LMJ Z JiaoZhu Chadalt Jaedong LMJ JiaoZhu LMJ LMJ Chadalt | ||||||
Sample Output | ||||||
End in a draw! End in a draw! XiaoM Wins! TianT Wins! | ||||||
Hint | ||||||
输入量巨大,建议使用scanf()与printf(),使用cin与cout可能会超时 | ||||||
Author | ||||||
Chadalt |
思路
简单map应用,直接把选手与其种族对应即可。
AC代码
#include<bits/stdc++.h>
using namespace std;
void solve(void)
{
int n,m;
cin>>n>>m;
map<string,char>mp;
for(int i = 0 ; i < m ; i++){
string a;
char b;
cin>>a>>b;
mp[a]=b;
}
for(int i = 0 ; i < m ; i++){
string na,nb;
cin>>na>>nb;
if(mp[na]=='T'){
if(mp[nb]=='T') cout<<"End in a draw!"<<endl;
else if(mp[nb]=='P') cout<<"TianT Wins!"<<endl;
else cout<<"XiaoM Wins!"<<endl;
}
else if(mp[na]=='Z'){
if(mp[nb]=='T') cout<<"TianT Wins!"<<endl;
else if(mp[nb]=='P') cout<<"XiaoM Wins!"<<endl;
else cout<<"End in a draw!"<<endl;
}
else{
if(mp[nb]=='T') cout<<"XiaoM Wins!"<<endl;
else if(mp[nb]=='P') cout<<"End in a draw!"<<endl;
else cout<<"TianT Wins!"<<endl;
}
}
}
int main(void)
{
solve();
return 0;
}