QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#167018 | #7110. Kuririn MIRACLE | ucup-team198 | WA | 0ms | 3808kb | C++20 | 1.8kb | 2023-09-06 23:03:23 | 2023-09-06 23:03:25 |
Judging History
answer
#include<iostream>
#include<algorithm>
#include<string.h>
#include<vector>
#include<cmath>
using namespace std;
// #define debug(x) cout<<"[debug]"#x<<"="<<x<<endl
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const ld eps=1e-10;
const int INF=0x3f3f3f3f,mod=998244353;
const ll INFF=0x3f3f3f3f3f3f3f3f;
#ifndef ONLINE_JUDGE
#define debug(...)
#include<debug>
#else
#define debug(...)
#endif
const ld PI=acos(-1);
int sign(ld x)
{
if(abs(x)<eps) return 0;
else if(x<0) return -1;
else return 1;
}
int dcmp(ld x,ld y)
{
if(abs(x-y)<eps) return 0;
else if(x<y) return -1;
else return 1;
}
ld v,r,d;
ld V(ld x)
{
ld cx=cos(x);
ld t=(-cx+sqrtl(cx*cx+3))*v;
return t;
}
ld f(ld x)//自行修改f函数
{
return 2*r/V(x);
}
ld simpson(ld a,ld b)
{
ld mid=(a+b)/2;
return (b-a)*(f(a)+4*f(mid)+f(b))/6;
}
ld merge_block(ld l,ld r,ld s)
{
// debug(l,r);
ld mid=(l+r)/2;
ld left=simpson(l,mid);
ld right=simpson(mid,r);
if(abs(s-(left+right))<eps) return left+right;
else return merge_block(l,mid,left)+merge_block(mid,r,right);
}
bool check(ld t)
{
ld d2=d-v*t;
ld a=2*r;
ld c=d2-2*r;
ld detal=asin(a/c);
ld res=merge_block(0,PI/2,simpson(0,PI/2))+merge_block(0,detal,simpson(0,detal))+sqrtl(c*c-a*a)/V(detal);
return res<=t;
}
void solve()
{
scanf("%Lf%Lf%Lf",&v,&r,&d);
ld res=d/v;
if(sign(d-4*r)>=0)
{
ld lo=0,hi=(d-4*r)/v-eps;
while(hi-lo>eps)
{
ld mid=(lo+hi)/2;
if(check(mid)) hi=mid;
else lo=mid;
}
if(check(lo))
res=min(res,lo);
}
printf("%.15Lf\n",res);
}
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3808kb
input:
1 2.00 3 30.0
output:
15.000000000000000
result:
wrong answer 1st numbers differ - expected: '8.3105799', found: '15.0000000', error = '0.8049282'