有大佬能帮忙看看嘛,10分,不知道哪里错了,会回关非常感谢

B2065 鸡尾酒疗法

sweet_520 @ 2024-10-17 09:22:50

#include<iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int a, b;
    int c, d;
    double m1;
    cin >> a >> b;
    double m = b * 1.0 / a;
    for (int i = 1; i < n; i++)
    {
        cin >> c >> d;
        m1 = d * 1.0 / c;
        if (m1-m > 0.05)
        {
            cout << "better"<<endl;
        }
        else if (m-m1 > 0.05)
        {
            cout << "wores" << endl;
        }
        else
        {
            cout << "same" << endl;
        }

    }
    return 0;
}

by Deuteron @ 2024-10-17 10:07:34

@sweet_520 "worse" 打错了。


by sweet_520 @ 2024-10-17 14:00:04

@Deuteron 改完之后0分了


by sweet_520 @ 2024-10-17 14:06:12

@Deuteron 对的对的,可能没弄好,没有问题


|