QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#190739 | #5253. Denormalization | ucup-team902# | WA | 1ms | 3992kb | C++17 | 1.0kb | 2023-09-29 13:38:15 | 2023-09-29 13:38:16 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int n;
double a[100005];
bool check(vector<int> x)
{
const double eps = 1e-12;
long long tot = 0;
for (int i = 1; i <= n; ++i) {
tot = tot + x[i] * x[i];
}
double d = sqrt(tot);
vector<double> tl(n + 1, 0);
for (int i = 1; i <= n; ++i) {
tl[i] = x[i] / d;
if (fabs(tl[i] - a[i]) > eps)
return 0;
}
return 1;
}
int main()
{
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
scanf("%lf", &a[i]);
for (int i = 1; i <= 10000; ++i) {
vector<int> tmp(n + 1, 0);
for (int j = 1; j <= n; ++j) {
tmp[j] = (int)i * a[j] / a[1];
}
int g = 0;
for (int j = 1; j <= n; ++j)
g = __gcd(g, tmp[j]);
if (g == 1) {
if (check(tmp)) {
for (int j = 1; j <= n; ++j) {
printf("%d\n", tmp[j]);
}
return 0;
}
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3992kb
input:
2 0.909840249060 0.414958698174
output:
result:
wrong output format Unexpected end of file - int32 expected