1 条题解

  • 0
    @ 2025-6-20 12:08:00

    你的输入的数据也得定义成浮点,否则全是same

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int n;
        double x,y;
        cin>>n;
        cin>>x>>y;
        double jwj=y/x;
        for(int i=1;i<n;i++){
            cin>>x>>y;
            double gj=y/x;
            if(gj-jwj>=0.05)
                cout<<"better"<<endl;
            else if(jwj-gj>=0.05)
                cout<<"worse"<<endl;
            else cout<<"same"<<endl;
        }
        return 0;
    }
    
    • 1

    信息

    ID
    209
    时间
    1000ms
    内存
    128MiB
    难度
    8
    标签
    递交数
    15
    已通过
    6
    上传者