QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#198529#5253. DenormalizationPHarr#WA 1ms3976kbC++20828b2023-10-03 14:37:182023-10-03 14:37:19

Judging History

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

  • [2023-10-03 14:37:19]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3976kb
  • [2023-10-03 14:37:18]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using ldb = long double;
#define int long long
constexpr ldb eps = 1E-11;


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;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3976kb

input:

2
0.909840249060
0.414958698174

output:


result:

wrong output format Unexpected end of file - int32 expected