QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#190739#5253. Denormalizationucup-team902#WA 1ms3992kbC++171.0kb2023-09-29 13:38:152023-09-29 13:38:16

Judging History

你现在查看的是最新测评结果

  • [2023-09-29 13:38:16]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3992kb
  • [2023-09-29 13:38:15]
  • 提交

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