QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#285504#5253. Denormalizationlight_ink_dots#WA 0ms3892kbC++14914b2023-12-16 19:48:212023-12-16 19:48:21

Judging History

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

  • [2023-12-16 19:48:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3892kb
  • [2023-12-16 19:48:21]
  • 提交

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 - round(s * s)) >= 1e-2)
            continue;
        static int ans[maxn];
        ans[1] = a;
        bool flag = true;
        long double val = 0;
        for (int i = 1; i <= n; i++) ans[i] = roundl(x[i] * s), val += (long long)ans[i] * ans[i];
        val = sqrtl(val);
        for (int i = 1; i <= n; i++)
            if (fabsl(ans[i] / val - x[i]) > 1e-6) {
                flag = false;
                break;
            }
        if (flag) {
            for (int i = 1; i <= n; i++) printf("%d\n", ans[i]);
            return 0;
        }
    }
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3892kb

input:

2
0.909840249060
0.414958698174

output:

7946
3624

result:

wrong answer the greatest common divisor is 2, but expected 1.