midsummer_zyl @ 2023-07-02 21:01:49
#include <bits/stdc++.h>
int a[100005], b[100005];
using namespace std;
int main() {
int n;
double x, y;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d%d", &a[i], &b[i]);
x = b[1] / a[1] * 1.0;
for (int i = 2; i <= n; i++) {
y = b[i] / a[i] * 1.0;
if(y - x > 0.05)
printf("better\n");
else if(x - y > 0.05)
printf("worse\n");
else
printf("same\n");
}
return 0;
}
为啥全输出same呢?
by Miracle_1024 @ 2023-07-02 22:13:19
@midsummer_zyl
y - x > 0.05
应该为>=
by midsummer_zyl @ 2023-07-03 07:57:47
@SunArrebol
ok