#萌新求助

B2065 鸡尾酒疗法

zt17 @ 2022-05-03 09:49:29

啊啊啊全WA了 代码:

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

int main()
{
    int n;
    cin >> n;
    int a,b;
    cin >> a >> b;
    for (int i=2;i<=n;i++)
    {
        int a1,b1;
        cin >> a1 >> b1;
        double x,y;
        x = b*1.00/a;
        y = b1*1.00/a1;
        if(x-y > 0.05) cout << "worse";
        else if (y-x > 0.05) cout << "better";
        else cout << "same";
    }
    return 0;
}

by zt17 @ 2022-05-03 09:54:34

到底错在哪里了啊


by ivyjiao @ 2022-05-03 10:03:26

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

int main()
{
    int n;
    cin >> n;
    int a,b;
    cin >> a >> b;
    for (int i=2;i<=n;i++)
    {
        int a1,b1;
        cin >> a1 >> b1;
        double x,y;
        x = b*1.00/a;
        y = b1*1.00/a1;
        if(x-y > 0.05) cout << "worse\n";
        else if (y-x > 0.05) cout << "better\n";
        else cout << "same\n";
    }
    return 0;
}

@Justin123_

你没换行!!!


by ivyjiao @ 2022-05-03 10:04:17

修改前

修改后


by ivyjiao @ 2022-05-03 10:06:42

@Justin123_


by ivyjiao @ 2022-05-03 10:07:53

啊链接放错了修改前


by zt17 @ 2022-05-03 10:30:10

@ivyjiao
啊嘞?哪里没换行?


by ivyjiao @ 2022-05-03 10:31:15

@Justin123_ 输出


by zt17 @ 2022-05-03 10:32:17

@ivyjiao 哦……谢谢!


by ivyjiao @ 2022-05-03 10:34:13

@Justin123_ 知道方法了A了这道题吧


|