解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int n= scanner.nextInt();
double a1= scanner.nextDouble();
double b1= scanner.nextDouble();
double x=b1/a1; //鸡尾酒疗法的有效率x(注意b1/a1)
for (int i=1;i<n;i++) {
double a2 = scanner.nextDouble();
double b2 = scanner.nextDouble();
double y = (b2 / a2) ; //for循环求出各个新疗法的有效率
if (y - x > 0.05) {
System.out.println("better");
}
else if (x-y>0.05){
System.out.println("worse");
}else {
System.out.println("same");
}
}
}
}
0.0分
0 人评分