QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#285497 | #5253. Denormalization | light_ink_dots# | WA | 0ms | 3928kb | C++14 | 810b | 2023-12-16 19:45:26 | 2023-12-16 19:45:26 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
static const int maxn = 10010;
int n;
scanf("%d", &n);
static long double x[maxn];
for (int i = 1; i <= n; i++) scanf("%Lf", x + i);
for (int a = 1; a <= 10000; a++) {
long double s = a / x[1];
if (fabsl(s * s - roundl(s * s)) >= 1e-2)
continue;
static int ans[maxn];
ans[1] = a;
bool flag = true;
for (int i = 2; i <= n; i++) {
ans[i] = roundl(x[i] * s);
if (fabsl(x[i] * s - ans[i]) >= 1e-8) {
flag = false;
break;
}
}
if (flag) {
for (int i = 1; i <= n; i++) printf("%d\n", ans[i]);
return 0;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3928kb
input:
2 0.909840249060 0.414958698174
output:
9665 4408
result:
ok good solution
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3824kb
input:
3 0.005731604132 0.696198848562 0.717826101486
output:
result:
wrong output format Unexpected end of file - int32 expected