QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#66485#5152. Circular Caramel Cookiekaruna#WA 3ms3616kbC++17512b2022-12-08 19:12:482022-12-08 19:12:52

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-08 19:12:52]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3616kb
  • [2022-12-08 19:12:48]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

ll func(ll R) {
    ll ans = 0;
    for (ll i = 1; i * i <= R; i++) {
        ans += floor(sqrt(R - i * i));
    }
    return ans * 4;
}
int main() {
    cin.tie(0); ios_base::sync_with_stdio(0);
    ll n; cin >> n;

    ll L = 0, R = 4'000'000'000ll;
    while (L < R) {
        ll M = (L + R) / 2;
        if (func(M) >= n) R = M;
        else L = M + 1;
    }
    cout.precision(20);
    cout << fixed << sqrt(L);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3580kb

input:

11

output:

2.23606797749978980505

result:

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

Test #2:

score: 0
Accepted
time: 3ms
memory: 3468kb

input:

59

output:

5.00000000000000000000

result:

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

Test #3:

score: 0
Accepted
time: 3ms
memory: 3612kb

input:

1

output:

1.41421356237309514547

result:

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

Test #4:

score: 0
Accepted
time: 3ms
memory: 3612kb

input:

2

output:

1.41421356237309514547

result:

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

Test #5:

score: 0
Accepted
time: 3ms
memory: 3608kb

input:

3

output:

1.41421356237309514547

result:

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

Test #6:

score: -100
Wrong Answer
time: 1ms
memory: 3616kb

input:

4

output:

1.41421356237309514547

result:

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