//保留小数: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; 为啥呀!!!!!!
共 2 条回复
因为数据有问题
#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; }