样例都没过,大佬看看吧

B2065 鸡尾酒疗法

tyt_ @ 2024-10-22 18:29:13

#include<bits/stdc++.h>
using namespace std;
    int a[45];
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n*2;i++) cin>>a[i];
    for(int i=0;i<n*2;i+=2){
        if((a[i+1]-a[i])>0.05) cout<<"better"<<endl;
        else if((a[i]-a[i+1])>0.05) cout<<"worse"<<endl;
        else cout<<"same"<<endl;    
    }
}

by lzc120518 @ 2024-10-22 18:35:49

首先啊a[i+1]-a[i]是整数 拿他判断0.05显然不行啊


by Scez @ 2024-10-22 18:35:58

@tyt_ 求的是有效率,不是人数差


by Scez @ 2024-10-22 18:36:28

@tyt_ 有效率是有效人数与样本人数的比值


by lzc120518 @ 2024-10-22 18:36:57

其次建议再读一遍题哈


by tyt_ @ 2024-10-22 18:37:35

@lzc120518 没读题啊哈哈


by tyt_ @ 2024-10-22 18:38:08

@Scez 没读题啊哈哈


by lst_hhh @ 2024-10-22 18:55:06


#define ll long long
using namespace std;
ll n;
double x, y, a, b;
int main(){
    cin >> n >> a >> b;
    x = b / a;
    for(ll i = 1; i < n; i++){
        cin >> a >> b;
        y = b / a;
        if(x * 100 - y * 100 > 5){
            cout << "worse" << endl;
        }
        else if(y * 100 - x * 100 > 5){
            cout << "better" << endl;
        }
        else{
            cout << "same" << endl;
        }
    }
    return 0;
}```

|