# 剪刀石头布

``````5
Rock Scissors
Scissors Rock
Cloth Cloth
Cloth Rock
Rock Rock``````

``W``

``````#include <stdio.h>
#include <stdlib.h>
#include<math.h>
int main()
{
int i,k=0,j=0,n;
char a[20],b[20];
scanf("%d",&n);
for(i=0; i<n; i++)
{
scanf("%s%s",a,b);
if((a[0]=='S'&&b[0]=='C')||(a[0]=='R'&&b[0]=='S')||(a[0]=='C'&&b[0]=='R'))k++;
else if(a[0]==b[0])
{
k++;
j++;
}
else j++;
a[0]='\0';b[0]='\0';
}
if(k==j)printf("D");
if(k<j)printf("L");
if(k>j)printf("W");
return 0;
}``````

``````
#include <iostream>
using namespace std;
class RSC
{
private:
char a[21][10];
char b[21][10];
int n;
char result;
int judge(char a,char  b);
public:
void input();
void output();
void decide();
};
int RSC::judge(char a,char b)
{
int w;
if(a>b)
w=-1;
else if(a<b)
w=1;
else
w=0;
return(w);
}
void RSC::input()
{
cin>>n;
int i;
for(i=0; i<n; i++)
cin>> a[i]>>b[i];
}
void RSC::output()
{
decide();
cout<<result<<endl;
}
void RSC::decide()
{
int num=0,i;
for(i=0; i<n; i++)
num = num + judge(a[i][0],b[i][0]);
if(num>0)
result ='W';
else if(num==0)
result= 'D';
else
result = 'L';
}
int main()
{
RSC test;
test.input();
test.output();
return 0;
}
``````