解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int cocktailCases = scanner.nextInt();
int cocktailEffectiveCases = scanner.nextInt();
for (int i = 1; i < n; i++) {
int cases = scanner.nextInt();
int effectiveCases = scanner.nextInt();
double cocktailRate = (double) cocktailEffectiveCases / cocktailCases;
double rate = (double) effectiveCases / cases;
if (rate - cocktailRate > 0.05) {
System.out.println("better");
} else if (cocktailRate - rate > 0.05) {
System.out.println("worse");
} else {
System.out.println("same");
}
}
}
}
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题9.10 (C语言代码)浏览:626 |
妹子杀手的故事 (C语言代码)浏览:737 |
Hello, world! (C语言代码)浏览:1315 |
C语言训练-角谷猜想 (C语言代码)浏览:1767 |
WU-输出正反三角形 (C++代码)浏览:1098 |
C语言程序设计教程(第三版)课后习题10.1 (C语言代码)浏览:585 |
母牛的故事 (C语言代码)浏览:1045 |
蚂蚁感冒 (C语言代码)浏览:816 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:654 |
C二级辅导-阶乘数列 (C语言代码)浏览:583 |