Cuber_release @ 2023-08-03 00:52:25
#include <bits/stdc++.h>
using namespace std;
double n, x, y, subx, suby, old, newed;
int main() {
cin >> n;
cin >> subx >> suby;
newed = subx / suby;
for (long long i = 1; i <= n - 1; i++) {
cin >> x >> y;
old = x / y;
if (newed - old > 0.050) {
cout << "better" << "\n";
} else if (old - newed > 0.050) {
cout << "worse" << "\n";
} else
cout << "same" << "\n";
}
return 0;
}
by luogu10086 @ 2023-08-03 15:49:58
供参考
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
int a,b;
double x,y;
cin >> n >> a >> b;
x = b / (double)a;
for (int i = 0;i < n - 1;i ++){
cin >> a >> b;
y = (double)b / a;
if (y - x > 0.05)cout << "better" << endl;
else if(x - y > 0.05)cout << "worse" << endl;
else cout << "same" << endl;
}
}