60分求助!
查看原帖
60分求助!
1304155
linzichen1楼主2024/4/8 22:44
#include<bits/stdc++.h>//万能头
using namespace std;
int n;//数据组数+1
double x,y,a,b;//x,y表示鸡尾酒疗法;a,b表示新式疗法
int main(){
    cin>>n;
    cin>>x>>y;//读入
    n--;//记得将n-1,不然会全WA
    while(n--){//n-1组数据
        cin>>a>>b;//读入
        double m=y/x,n=b/a;//算出成功率
        if(m-n>0.05)cout<<"worse"<<endl;//更差
        else if(n-m>0.05)cout<<"better"<<endl;//更好
        else cout<<"same"<<endl;//其他情况
    }
    return 0;//完美结束
}
2024/4/8 22:44
加载中...