QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#65999 | #5152. Circular Caramel Cookie | paxaq | WA | 8ms | 3600kb | C++14 | 679b | 2022-12-05 16:38:44 | 2022-12-05 16:38:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll count(double r) {
ll res = 0;
for (int i = 1; i <= r; i++) {
res += floor(pow(r * r - i * i, 0.5));
}
return 4 * res;
}
void solve() {
ll s;
cin >> s;
double lo = 1, hi = 1e5;
double delta = 1e-7;
while (lo + delta < hi) {
double mid = (lo + hi) / 2;
if (count(mid) < s) {
lo = mid;
} else {
hi = mid;
}
}
cout << lo << '\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.precision(16);
int t = 1;
//cin >> t;
while (t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 8ms
memory: 3408kb
input:
11
output:
2.236067973107311
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 4ms
memory: 3524kb
input:
59
output:
4.999999916319211
result:
ok found '4.9999999', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
1
output:
1.414213487264533
result:
ok found '1.4142135', expected '1.4142136', error '0.0000001'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3600kb
input:
2
output:
1.414213487264533
result:
ok found '1.4142135', expected '1.4142136', error '0.0000001'
Test #5:
score: 0
Accepted
time: 4ms
memory: 3576kb
input:
3
output:
1.414213487264533
result:
ok found '1.4142135', expected '1.4142136', error '0.0000001'
Test #6:
score: -100
Wrong Answer
time: 3ms
memory: 3528kb
input:
4
output:
1.414213487264533
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142135', error = '0.3675445'