QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#96634#5152. Circular Caramel CookieMostafa_MoharramWA 2ms3484kbC++14794b2023-04-14 22:20:082023-04-14 22:20:13

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-14 22:20:13]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3484kb
  • [2023-04-14 22:20:08]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using ld = long double;

int s;
// 
// SSSS

bool inside(ld r, int x, int y) {
    return 1ll * x * x + 1ll * y * y <= r * r + 1e-8l;
}
int check(ld r) {
    int rm = 0;
    int x = r;
    int y = 1;
    while (x > 0) {
        while (x > 0 and not inside(r, x, y))
            --x;
        rm += x;
        ++y;
    }
    return 4 * rm;
}

signed main() {
    ios::sync_with_stdio(false); cout.tie(nullptr); cin.tie(nullptr);
    // cout << check(1.41421356237l);
    cin >> s;
    ld l = 0, r = 2 * sqrtl(s);
    for (int _ = 0; _ < 100; ++_) {
        ld m = (l + r) / 2;
        if (check(m))
            r = m;
        else l = m;
    }
    cout << fixed << setprecision(12) << l << '\n';
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3484kb

input:

11

output:

1.414213558838

result:

wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'