wa 求助

B2065 鸡尾酒疗法

GipsyAvenger1 @ 2023-12-17 17:36:14

#include<iostream>
using namespace std;
int main(){
    int a,x,v;
    cin>>a;
    double b[a];
    for(int i=1;i<=a-1;i++){
        cin>>x>>v;
        b[i]=v/x;
        b[i+1]=x/v;
        if(b[i+1]-b[i]>0.05)
            cout<<"better"<<endl;
        if(b[i]-b[i+1]>0.05)
            cout<<"worse"<<endl;
        else
            cout<<"same"<<endl;
    }
    return 0;
}

by wd133 @ 2023-12-17 17:55:19

用不着数组 直接两个cur i要从2开始循环


by wd133 @ 2023-12-17 17:56:26

@lirunsong


|