QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#159506 | #7110. Kuririn MIRACLE | ucup-team206# | WA | 0ms | 3956kb | C++17 | 1.2kb | 2023-09-02 17:59:46 | 2023-09-02 17:59:46 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define double long double
const double eps=1e-7,pi=acos(-1);
int T;
double v,r,d;
double f(double x)
{
double sx=sin(x);
return 2*r/v/(sqrt(sx*sx+3)-sx);
}
double F(double l,double r)
{
return (f(l)+f(r)+4*f((l+r)/2))*(r-l)/6.0;
}
double I(double l,double r)
{
double mid=(l+r)/2;
if(fabs(F(l,r)-F(l,mid)-F(mid,r))<eps)
return F(l,mid)+F(mid,r);
return I(l,mid)+I(mid,r);
}
double check(double a,double b)
{
double t=I(0,a);
double x=2*r+v*t-cos(a)*2*r;
double y=sin(a)*2*r;
double ax=x-y/tan(a);
t=I(0,b);
x=2*r+v*t-cos(b)*2*r;
y=sin(b)*2*r;
double bx=x-y/tan(b);
if(ax>bx)
swap(ax,bx);
return ax<=d&&d<=bx;
}
int main()
{
scanf("%d",&T);
while(T--)
{
scanf("%Lf%Lf%Lf",&v,&r,&d);
double tl=I(0,pi);
if(tl>d/v)
printf("%.10Lf\n",d/v);
else
{
double L=pi/2,R=pi;
while((R-L)/max((double)1.0,R)>eps)
{
double mid=(L+R)/2;
if(check(L,mid))
R=mid;
else
L=mid;
}
double a=(L+R)/2;
double t=I(0,a);
double x=2*r+v*t-cos(a)*2*r;
double y=sin(a)*2*r;
t+=sqrt((d-x)*(d-x)+y*y)/(v*2);
printf("%.10Lf\n",t);
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3956kb
input:
1 2.00 3 30.0
output:
8.3107615194
result:
wrong answer 1st numbers differ - expected: '8.3105799', found: '8.3107615', error = '0.0000218'