80pts求助

B2065 鸡尾酒疗法

BH9570 @ 2024-12-22 10:12:37

#include<bits/stdc++.h>
using namespace std;
struct HAART{
    double sum;
    double yes;
    double yesprobability;
};
HAART a[21];
int main() {
    int n;
    cin >> n;
    cin >> a[0].sum >> a[0].yes;
    a[0].yesprobability = a[0].sum / a[0].yes * 100;
    for (int i = 1; i < n; i++) {
        cin >> a[i].sum >> a[i].yes;
        a[i].yesprobability = a[i].sum / a[i].yes * 100;
    }
    for (int i = 1; i < n; i++) {
        if (a[0].yesprobability - a[i].yesprobability > 5) {
            cout << "better" << endl;
        }
        else if (a[i].yesprobability - a[0].yesprobability > 5) {
            cout << "worse" << endl;
        }
        else {
            cout << "same" << endl;
        }
    }
    return 0;
}

屈辱历史


by BH9570 @ 2024-12-26 17:46:06

已AC。


|