提交时间:2024-01-13 22:36:46
运行 ID: 36522
#include<iostream> #include<cstring> using namespace std; int a[101]; int main() { int N; cin>>N; for(int i=0;i<N;i++){ char s1[20],s2[20]; cin>>s1>>s2; char* Rock="Rock"; char* Paper="Paper"; char* Scissors="Scissors"; int a1=strcmp(s1,Rock); int b1=strcmp(s1,Paper); int c1=strcmp(s1,Scissors); int a2=strcmp(s2,Rock); int b2=strcmp(s2,Paper); int c2=strcmp(s2,Scissors); if((a1==0&&a2==0)||(b1==0&&b2==0)||(c1==0&&c2==0)){ a[i]=0; } else if((a1==0&&b2==0)||(b1==0&&c2==0)&&(c1==0&&a2==0)){ a[i]=2; } else{ a[i]=1; } } for(int i=0;i<N;i++){ if(a[i]==0){ cout<<"Tie"; } else if(a[i]==1){ cout<<"Player1"; } else{ cout<<"Player2"; } cout<<endl; } return 0; }