#include <iostream>
using namespace std;

int main() {
    int lost = 0, rounds;
    string choices[] = {"", "石头", "剪刀", "布"};
    
    cout << "欢迎来到石头剪刀布游戏!\n要玩几次:";
    cin >> rounds;
    
    for (int i = 0; i < rounds; ) {
        int player;
        cout << "选择(1.石头,2.剪刀,3.布):";
        cin >> player;
        
        if (player < 1 || player > 3) {
            cout << "请输入正确的选项(1.石头,2.剪刀,3.布)\n";
            continue;
        }
        
        int computer = (player + 1) % 3 + 1;
        cout << "电脑选择:" << choices[computer] << ", 你的选择:" << choices[player] << endl;
        
        if (player == computer % 3 + 1) lost++;
        cout << (player == computer ? "平局!" : player > computer && (player != 3 || computer != 1) || (player == 1 && computer == 3) ? "你赢了!" : "你输了!") << endl;
        i++;
    }
    
    cout << (lost > rounds/2 ? "你输了,输了" + to_string(lost) + "局" : 
            lost < rounds/2 ? "你赢了,赢了" + to_string(rounds-lost) + "局" : "平局!");
    return 0;
}