求助

B2065 鸡尾酒疗法

denghuolanshan_1004 @ 2023-06-18 13:02:47

全same了。

#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main() {
    int n;
    cin>>n;
    n-=1;
    int a,b;
    cin>>a>>b;
    double x=b/a;

    for(int i=0;i<n;i++){
        cin>>a>>b;
        double cc=b/a;
        if (cc-x>0.05)cout<<"better"<<endl;
        else if(x-cc>0.05)cout<<"worse"<<endl;
        else cout<<"same"<<endl;
    }
    return 0;
}

by BLuemoon_ @ 2023-06-18 13:15:07

a,b 都要开 double


by BLuemoon_ @ 2023-06-18 15:07:29

@denghuolanshanchu


by denghuolanshan_1004 @ 2023-06-18 21:33:57

谢谢


by zhaoziqiang123456 @ 2023-08-16 15:40:24


|