!!!

B2065 鸡尾酒疗法

皓月星辉 @ 2022-03-18 11:50:34


#include<iomanip>
using namespace std;
int main()
{
    double a,b,c,d,y,x,z,n,e[100];
    cin>>n>>a>>b;
    x=b/a*0.95;
    y=b/a*1.05;
    for(int i=0;i<n-1;i++)
    {
        cin>>c>>d;
        z=d/c;
        if(z>=y)e[i]=1;
        else
        {
            if(z<=x)e[i]=0;
            else e[i]=2;
        }
    }
    for(int i=0;i<n-1;i++)
    {
        if(e[i]==0)cout<<"worse"<<endl;
        if(e[i]==2)cout<<"same"<<endl;
        if(e[i]==1)cout<<"better"<<endl;
    }
    return 0;
}```

by snhDL @ 2022-03-18 12:07:48


by songhx @ 2022-03-18 12:10:28

没有iostream


by songhx @ 2022-03-18 12:17:00

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
    double a,b,c,d,x,y,n;
    cin>>n>>a>>b;
    x = b / a*1.0;
    for(int i=0;i<n-1;i++){
        cin >> c >> d;
        y = d / c;
        if(y - x >= 0.05) cout << "better" << endl;
        else {
            if(x - y >= 0.05) cout << "worse" << endl;
            else cout << "same" << endl;
        }
    }
    return 0;
}

楼主帮您改完了


by BMTXLRC @ 2022-03-18 12:21:57

语言功能有障碍吗。


by xhz_ @ 2022-03-18 12:38:31

会与人交流吗?只发个代码谁知道你要干什么。


by Papyrus_Sans @ 2022-08-20 14:38:00

你食不食油饼,把话说清楚啊


|