您的位置:首页 > 其它

1019石头、剪刀、布

2013-12-16 17:56 295 查看
#include <iostream>
using namespace std;
int main()
{
int t;
cin>>t;
int a,b,n;
char c1,c2;
for(int i=0;i<t;i++)
{
a=0;
b=0;
cin>>n;
for(int j=0;j<n;j++)
{
cin>>c1>>c2;
if(c1=='R')
{
if(c2=='S')
a++;
else if(c2=='P')
b++;
else if(c2=='R')
{
a++;
b++;
}
}
else if(c1=='P')
{
if(c2=='R')
a++;
else if(c2=='S')
b++;
else if(c2=='p')
{
a++;
b++;
}
}
else if(c1=='S')
{
if(c2=='P')
a++;
else if(c2=='R')
b++;
else if(c2=='S')
{
a++;
b++;
}
}
}
if(a>b)
{
cout<<"Player 1"<<endl; }
else if(a<b)
{cout<<"Player 2"<<endl;
}
else if (a==b)
{     cout<<"TIE"<<endl;
}
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: