跳到正文

题解

题解:P10352 [PA2024] Kto wygrał?

Mierstan085约 2 分钟
原文
文章信息与版本

文章信息

发布
2024年4月17日
收录
2026年9月21日
更新
2026年11月14日
篇幅
约 2 分钟
获赞
5
题目
P10352

版本

  1. v1当前

这是一道 PA 难得的简单题。

思路是先计算两个人的成绩和,然后开一个桶数组来分别记录两个人同样分数的题目的个数。

然后先比较成绩和,在从 1010 开始到 00 比有没有不同的,如果桶数组没有一个不同,就输出 remis,然后就根据情况输出 Algosia 和 Bajtek(上文名字是 Bysie,下文变了)。

代码是这样的:

C++
#include <bits/stdc++.h>
using namespace std;

int cnt[2][20], a[2];
int main(){
    for (int i = 0; i < 2; i ++){
        for (int j = 0; j < 18; j ++){
            int x;
            cin >> x;
            cnt[i][x] ++;
            a[i] += x;
        }
    }
    
    if (a[0] == a[1]){
        for (int i = 10; i >= 0; i --){
            if (cnt[0][i] != cnt[1][i]){
                if (cnt[0][i] > cnt[1][i]){
                    cout << "Algosia";
                    return 0;
                }else{
                    cout << "Bajtek";
                    return 0;
                }
            }
        }
        
        cout << "remis";
    }else{
        if (a[0] > a[1]) cout << "Algosia";
        else cout << "Bajtek";
    }
}

完结撒花~

原文