| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 80008 | sh25_huangse | 鸡尾酒疗法 | C++ | 通过 | 0 MS | 256 KB | 897 | 2026-01-04 14:55:51 |
#include <iostream> #include <iomanip> // 虽然本题不要求输出小数,但用于确保浮点数计算 using namespace std; int main() { int n; cin >> n; int total0, effective0; cin >> total0 >> effective0; double rate0 = (double)effective0 / total0; // 鸡尾酒疗法的有效率 // 处理剩下的 n-1 组改进疗法 for (int i = 1; i < n; i++) { // 注意循环从1开始 int total, effective; cin >> total >> effective; double rate = (double)effective / total; // 改进疗法的有效率 double diff = rate - rate0; // 计算差值 // 根据差值判断效果 if (diff > 0.05) { cout << "better" << endl; } else if (diff < -0.05) { cout << "worse" << endl; } else { cout << "same" << endl; } } return 0; }