QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#207080 | #5152. Circular Caramel Cookie | Minhho | WA | 0ms | 3928kb | C++20 | 704b | 2023-10-08 07:31:35 | 2023-10-08 07:31:35 |
Judging History
answer
#define taskname "C"
#include <bits/stdc++.h>
#define ld long double
#define int long long
using namespace std;
const ld lim = sqrt(2.0L) - 1;
inline int cal(ld x)
{
int le = (x - trunc(x) >= lim ? trunc(x) : trunc(x-1));
int wi = sqrt(x*x-le*le);
wi <<= 1;
le <<= 1;
return 2 * le * wi - min(le, wi) * min(le, wi);
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
int s; ld l = 0, r = 4;
cin>>s;
for (int i=1; i<=1000; i++)
{
ld m = (l+r)/2;
// cerr<<m<<" "<<cal(m)<<"\n";
if (cal(m) > s) r = m;
else l = m;
}
cout<<fixed<<setprecision(9)<<r;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3796kb
input:
11
output:
2.236067977
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3928kb
input:
59
output:
4.000000000
result:
wrong answer 1st numbers differ - expected: '5.0000000', found: '4.0000000', error = '0.2000000'