QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#148979 | #5152. Circular Caramel Cookie | LaStataleBlue# | TL | 1ms | 3828kb | C++20 | 1.1kb | 2023-08-23 21:21:03 | 2023-08-23 21:21:04 |
Judging History
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