QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#198559 | #5253. Denormalization | PHarr# | WA | 0ms | 3684kb | C++20 | 830b | 2023-10-03 14:47:37 | 2023-10-03 14:47:38 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ldb = long double;
#define int long long
constexpr ldb eps = 0.00075;
int32_t main() {
int n;
cin >> n;
vector<ldb> a(n);
for (auto &i: a)
cin >> i;
for (int i = 1; i < n; i++) a[i] /= a[0];
vector<int> b(n);
for (b[0] = 1; b[0] <= 10000; b[0]++) {
int d = b[0];
for (int i = 1; i < n; i++) {
ldb x = (ldb) b[0] * a[i];
if (x - floor(x) < eps) b[i] = floor(x);
else if (ceil(x) - x < eps) b[i] = ceil(x);
else {
d = -1;
break;
}
d = gcd(d, b[i]);
}
if (d != 1) continue;
for (auto i: b)
cout << i << "\n";
return 0;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3684kb
input:
2 0.909840249060 0.414958698174
output:
296 135
result:
wrong answer incorrect solution