0······

abcdefg 2023-04-18 21:46:21 5
//保留小数:cout<<fixed<<setprecision(1)<<sum;
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <string>
using namespace std;
int main() {
    int n;
    cin >> n;
    string a[n], b[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    for(int i=0;i<n;i++){
		if( (a[i][0]=='R'&&b[i][0]=='S') || (a[i][0]=='S'&&b[i][0]=='P') || (a[i][0]=='P'&&b[i][0]=='R')){
			cout<<"Player2"<<endl;
		}else if(a[i][0]==b[i][0]){
			cout<<"Tie"<<endl;
		}else cout<<"player1"<<endl;
	}
}

过样例,WA,0; 为啥呀!!!!!!

{{ vote && vote.total.up }}

共 2 条回复

CPP 刷题王

因为数据有问题

tctm141

#include <bits/stdc++.h> using namespace std; int main() { int wasd; cin >> wasd; string a, b; for (int i = 1; i <= wasd; i++) { cin >> a >> b; if (a == b) cout << "Tie"; else if (a == "Rock" && b == "Scissors" || a == "Scissors" && b == "Paper" || a == "Paper" && b == "Rock") cout << "Player2"; else cout << "Player1"; cout << endl; } return 0; }