QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#198559#5253. DenormalizationPHarr#WA 0ms3684kbC++20830b2023-10-03 14:47:372023-10-03 14:47:38

Judging History

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

  • [2023-10-03 14:47:38]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3684kb
  • [2023-10-03 14:47:37]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using ldb = long double;
#define int long long
constexpr ldb eps = 0.00075;


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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
0.909840249060
0.414958698174

output:

296
135

result:

wrong answer incorrect solution