1 条题解

  • 1
    @ 2023-10-3 14:31:34
    #include<iostream>
    #include<algorithm>
    #include<cstring>
    #include<cstdio>
    #include<cmath> 
    #include<string>
    using namespace std;
    int main(){
    	int n;
    	cin >> n;
    	string s1,s2,s3;
    	s1 = "Rock";
    	s2 = "Scissors";
    	s3 = "Paper";
    	string tmp1,tmp2; 
    	for(int i=0;i<n;i++){
    		cin >> tmp1;
    		cin >> tmp2;
    		if(tmp1 == s1){
    			if(tmp2 == s1){
    				cout << "Tie" << endl;
    			}else if(tmp2 == s2){
    				cout << "Player1" << endl;
    			}else if(tmp2 == s3){
    				cout << "Player2" << endl;
    			}
    		}else if(tmp1 == s2){
    			if(tmp2 == s1){
    				cout << "Player2" << endl;
    			}else if(tmp2 == s2){
    				cout << "Tie" << endl;
    			}else if(tmp2 == s3){
    				cout << "Player1" << endl;
    			}
    		}else if(tmp1 == s3){
    			if(tmp2 == s1){
    				cout << "Player1" << endl;
    			}else if(tmp2 == s2){
    				cout << "Player2" << endl;
    			}else if(tmp2 == s3){
    				cout << "Tie" << endl;
    			}
    		}
    	}
    	return 0;
    }
    
    • 1

    信息

    ID
    6924
    时间
    1000ms
    内存
    128MiB
    难度
    1
    标签
    (无)
    递交数
    11
    已通过
    9
    上传者