题解:P10352 [PA2024] Kto wygrał?
Mierstan085 · · 题解
这是一道 PA 难得的简单题。
思路是先计算两个人的成绩和,然后开一个桶数组来分别记录两个人同样分数的题目的个数。
然后先比较成绩和,在从 remis,然后就根据情况输出 Algosia 和 Bajtek(上文名字是 Bysie,下文变了)。
代码是这样的:
#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";
}
}
完结撒花~