问题 R: 鸡尾酒疗法

#include<bits/stdc++.h>
 using namespace std;
 int main()
 {
 int a,b,c,d,k,n;
 double m,x;
 scanf("%d",&n);
 scanf("%d%d",&a,&b);
 m=(double)b/(double)a;//double(a)/double(b);
 for(int i=2;i<=n;i++){
 scanf("%d%d",&c,&d);
 x=(double)d/(double)c;
 if(x>=m-0.05&&x<=m+0.05)cout<<"same"<<"
";
 else if(x<m-0.05)cout<<"worse"<<"
";
 else cout<<"better"<<"
";}
 return 0;
 }

  

原文地址:https://www.cnblogs.com/5t2y0/p/9240729.html