QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#226722 | #5152. Circular Caramel Cookie | Fyind# | WA | 0ms | 3896kb | C++23 | 566b | 2023-10-26 14:36:44 | 2023-10-26 14:36:44 |
Judging History
answer
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
bool check(ll x, ll s) {
ll cnt = 0;
for (ll i = 1; i * i <= x; ++i)
cnt += sqrt(x - 1ll * i * i);//, cout << cnt << ',';
// cout << x << ':' << cnt << ',' << s << endl;
return cnt < s;
}
int main() {
ll s;
cin >> s;
s = (s + 3) / 4;
// cout << s << endl;
ll l = 0, r = s * s;
while (l <= r) {
ll mid = (l + r) / 2;
if(check(mid, s))
l = mid + 1;
else
r = mid - 1;
}
// cout << l << endl;
cout << fixed << setprecision(8) << sqrt(l) << '\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3660kb
input:
11
output:
2.23606798
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
59
output:
5.00000000
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
1
output:
1.41421356
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
2
output:
1.41421356
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
3
output:
1.41421356
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 3804kb
input:
4
output:
1.41421356
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'