why?
查看原帖
why?
1356734
huyouxi楼主2024/11/10 21:54

如果

#include<bits/stdc++.h>

using namespace std;

int main() {
    string s1, s2;
    int s;
    cin >> s;
    for (int i = 0; i < s; i++) {
        cin >> s1 >> s2;
        if (s1 == "Paper" && s2 == "Paper") {
            cout << "Tie\n";
        } else if (s1 == "Paper" && s2 == "Scissors") {
            cout << "Player2\n";
        } else if (s1 == "Paper" && s2  == "Rock") {
            cout << "Player1\n";
        } else if (s1 == "Scissors" && s2 == "Scissors") {
            cout << "Tie\n";
        } else if (s1 == "Scissors" && s2 == "Rock") {
            cout << "Player2\n";
        } else if (s1 == "Scissors\n" && s2 == "Paper") {
            cout << "Player1\n";
        } else if (s1 == "Rock" && s2 == "Rock") {
            cout << "Tie\n";
        } else if (s1 == "Rock" && s2 == "Paper") {
            cout << "Player2\n";
        } else {
            cout << "Player1\n";
        }
    }
    return 0;
}

就可AC,但

#include<bits/stdc++.h>

using namespace std;

int main() {
    string s1, s2;
    int s;
    cin >> s;
    for (int i = 0; i < s; i++) {
        cin >> s1 >> s2;
        if (s1 == "Paper" && s2 == "Paper") {
            cout << "Tie\n";
        }
        if (s1 == "Paper" && s2 == "Scissors") {
            cout << "Player2\n";
        }
        if (s1 == "Paper" && s2 == "Rock") {
            cout << "Player1\n";
        }
        if (s1 == "Scissors" && s2 == "Scissors") {
            cout << "Tie\n";
        }
        if (s1 == "Scissors" && s2 == "Rock") {
            cout << "Player2\n";
        }
        if (s1 == "Scissors\n" && s2 == "Paper") {
            cout << "Player1\n";
        }
        if (s1 == "Rock" && s2 == "Rock") {
            cout << "Tie\n";
        }
        if (s1 == "Rock" && s2 == "Paper") {
            cout << "Player2\n";
        }
        if (s1 == "Rock" && s2 == "Scissors") {
            cout << "Player1\n";
        }
    }
    return 0;
}

就只有20分

2024/11/10 21:54
加载中...