QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501208 | #5152. Circular Caramel Cookie | 1DemonS1 | WA | 0ms | 3920kb | C++20 | 1.2kb | 2024-08-02 15:40:24 | 2024-08-02 15:40:25 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 9;
const int mod = 1e9 + 7;
const double eps = 1e-9;
#define inf 2e18
ll ans;
double d=sqrt(2);
bool check(double x)
{
ll res=0,now=0;
ll st = x/d;
res += st * st;
if(res * 4 >= ans) return false;
ll nx = st + 1, ny = st;
//find_now
while(nx <= x)
{
ll l = 0, r = sqrt(x * x - nx * nx) + 10;
while (l < r)
{
//cout<<l<<' '<<r<<'\n';
ll mid = (l + r)/2 + 1;
if (nx * nx + mid * mid <= x * x) l = mid;
else r = mid - 1;
}
now += l;
nx++;
}
now *= 2;
res += now;
res *= 4;
if(res > ans) return false;
return true;
}
void solve()
{
cin>>ans;
ans ++;
double l=1, r=1e9 + 100, mid;
while(fabs(l-r)>=eps)
{
mid = (l+r)/2;
if(check(mid)) l = mid;
else r = mid;
}
printf("%.10lf",mid);
}
int main()
{
//ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int _ = 1; // cin>>_;
while (_--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3920kb
input:
11
output:
2.8284271247
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '2.8284271', error = '0.2649111'