「NLOI Round1」白鸟过河滩
题目等价于求
-
若一组是最好的,则
b\times x\leq c\times y 且a\times z\leq c\times x 。 -
否则,若二组是最好的,则
c\times y\leq b\times z 。 -
若均不满足,则三组是最好的。
另外本题卡精度,用 double 会拿到
std如下:
#include <bits/stdc++.h>
using namespace std;
int main(){
int t;cin>>t;
while(t--){
long long a,b,c,x,y,z;
cin>>a>>b>>c>>x>>y>>z;
if(a*y>=b*x && a*z>=c*x){
cout<<"1\n";
}else if(b*z>=c*y){
cout<<"2\n";
}else{
cout<<"3\n";
}
}
return 0;
}