样例过了,但全WA

B2065 鸡尾酒疗法

LYH_yes @ 2024-07-22 21:55:58

#include<bits/stdc++.h>
#include<cstring>
using namespace std;
int main()
{
    int n;
    double a,b,x,y;
    string key[21];
    cin>>n;
    cin>>a>>b;
    x=a/b*100;
    for(int i=2;i<=n;i++)
    {
        cin>>a>>b;
        y=a/b*100;
        if(y-x>5)
        {
            key[i-1]="better";
        }
        else if(x-y>5)
        {
            key[i-1]="worse";
        }
        else
        {
            key[i-1]="same";
        }
    }
    for(int i=1;i<=n;i++)
    {
        cout<<key[i]<<endl;
    }
    return 0;
}

by yangduan_ @ 2024-07-22 22:05:18

@LYH_yes 应该是 b/a


by LYH_yes @ 2024-07-22 22:09:30

@yangduan_ 谢谢


|