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 |
---|---|---|---|---|---|---|---|---|---|
#102568 | #5152. Circular Caramel Cookie | w4p3r# | WA | 2ms | 3580kb | C++20 | 715b | 2023-05-03 14:44:51 | 2023-05-03 14:44:52 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef double db;
const db eps=1e-9;
typedef long long ll;
int s=0;
bool check(db mid)
{
ll cnt=0;
for(int i=1;i<=mid;i++)
{
db d=mid*mid-1ll*i*i;
// cerr<<"i = "<<i<<", d = "<<d<<": \n";
int l=0,r=mid+1;
while(l+1<r)
{
// cerr<<l<<" "<<r<<"\n";
int m=l+r>>1;
if(1ll*m*m<=d) l=m;
else r=m;
}
cnt+=l;
}
// cerr<<"mid = "<<mid<<", cnt = "<<cnt<<"\n";
return 4*cnt>s;
}
int main()
{
scanf("%d",&s);
db l=0,r=sqrt(s);
while(l+eps<=r)
{
db mid=l+(r-l)*0.5;
// cerr<<l<<" "<<r<<" "<<mid<<": \n";
if(check(mid)) r=mid;
else l=mid;
// cerr<<"\n";
}
printf("%.20lf\n",r);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3468kb
input:
11
output:
2.23606797808101553926
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
59
output:
5.00000000031749713969
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3568kb
input:
1
output:
1.00000000000000000000
result:
wrong answer 1st numbers differ - expected: '1.4142136', found: '1.0000000', error = '0.2928932'