QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#148979#5152. Circular Caramel CookieLaStataleBlue#TL 1ms3828kbC++201.1kb2023-08-23 21:21:032023-08-23 21:21:04

Judging History

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

  • [2023-08-23 21:21:04]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:3828kb
  • [2023-08-23 21:21:03]
  • 提交

answer

#pragma ide diagnostic ignored "misc-no-recursion"

#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
typedef long double ldb;

#define TESTCASE 0

static constexpr int MOD = 998'244'353;
static constexpr int INF = 1e9;
static constexpr ldb EPS = 1e-15;

static ll count(ldb r) {
    ll x = r;
    ll res = 0;
    for (ll y = 1; y < r; y++) {
        while (x > 0 && (x * x + y * y) > r * r) {
            x--;
        }
        res += x;
    }
    return res * 4;
}

static void solve([[maybe_unused]] int tc) {
    ll S;
    cin >> S;

    ldb l = 0, r = 1e5;
    while ((r - l) > EPS) {
        ldb m = (l + r) / 2;
        if (count(m) <= S) {
            l = m;
        } else {
            r = m;
        }
    }

    cout << setprecision(10) << fixed << r << endl;
}

int main() {
    ios::sync_with_stdio(false);

    if (const char *f = getenv("REDIRECT_STDOUT"); f) {
        freopen(f, "w", stdout);
    }

    int T = 1;
#if TESTCASE
    cin >> T;
#endif

    for (int t = 1; t <= T; t++) {
        solve(t);
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3656kb

input:

11

output:

2.2360679775

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

59

output:

5.0000000000

result:

ok found '5.0000000', expected '5.0000000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3828kb

input:

1

output:

1.4142135624

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3732kb

input:

2

output:

1.4142135624

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #5:

score: 0
Accepted
time: 1ms
memory: 3732kb

input:

3

output:

1.4142135624

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

4

output:

2.2360679775

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #7:

score: -100
Time Limit Exceeded

input:

1000000000

output:


result: