QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#167017 | #7110. Kuririn MIRACLE | ucup-team198 | WA | 61ms | 3828kb | C++20 | 1.8kb | 2023-09-06 23:00:00 | 2023-09-06 23:00:00 |
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-9;
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;
}
res=min(res,lo);
}
printf("%.15Lf\n",res);
}
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
solve();
}
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3816kb
input:
1 2.00 3 30.0
output:
8.310579934107148
result:
ok found '8.3105799', expected '8.3105799', error '0.0000000'
Test #2:
score: -100
Wrong Answer
time: 61ms
memory: 3828kb
input:
100 8.66 6.05 71.59 8.44 8.67 82.55 4.23 9.68 24.74 6.63 9.95 7.45 1.2 7.27 97.55 2.08 2.94 31.61 8.48 5.56 20.16 7.35 5.55 52.48 1.35 8.15 51.23 3.88 9.02 72.37 7.03 1.97 57.03 1.78 4.44 93.44 5.5 6.11 52.94 1.09 9.64 69.01 1.01 3.54 16.78 1.63 4.55 44.06 5.82 5.51 5.92 5.62 2.93 76.01 4.75 4.43 73...
output:
4.457837122462936 5.488360808957094 5.848699763593381 1.123680241327300 43.266480053853463 8.305490138287654 2.377358490566038 4.015485969795014 13.799999998196734 9.353092781960733 4.155123643538366 27.178963006983283 5.181818180214939 27.935779814700723 2.594059404336618 15.093994460909896 1.01718...
result:
wrong answer 9th numbers differ - expected: '37.9481481', found: '13.8000000', error = '0.6363459'