QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#167021#7110. Kuririn MIRACLEucup-team198AC ✓320ms3908kbC++201.8kb2023-09-06 23:05:362023-09-06 23:05:37

Judging History

你现在查看的是最新测评结果

  • [2023-09-06 23:05:37]
  • 评测
  • 测评结果:AC
  • 用时:320ms
  • 内存:3908kb
  • [2023-09-06 23:05:36]
  • 提交

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-8;
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+eps))
        res=min(res,lo);
    }
    printf("%.15Lf\n",res);
}
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        solve();
    }
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3868kb

input:

1
2.00 3 30.0

output:

8.310579930511389

result:

ok found '8.3105799', expected '8.3105799', error '0.0000000'

Test #2:

score: 0
Accepted
time: 32ms
memory: 3908kb

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.457837120227814
5.488360805530453
5.848699763593381
1.123680241327300
43.266480050350129
8.305490134343410
2.377358490566038
4.015485966777936
37.948148148148148
18.652061855670103
4.155123637375629
27.178963007417036
9.625454545454545
63.311926605504587
16.613861386138614
15.093994461581957
1.017...

result:

ok 100 numbers

Test #3:

score: 0
Accepted
time: 320ms
memory: 3904kb

input:

1000
7.52 6.68 80.67
5.34 6.82 45.75
3.57 6.35 22.35
9.55 3.65 31.38
9.37 5.73 40.42
1.83 8.38 82.97
4.86 6.13 9.45
3.88 5.34 84.19
6.49 4.15 85.24
6.51 7.23 42.97
3.0 5.98 57.53
9.35 2.76 69.07
6.76 9.16 91.24
2.98 9.89 49.2
9.16 3.85 66.14
1.84 3.03 37.43
8.01 5.04 50.98
4.05 9.86 4.76
5.4 5.49 60...

output:

5.770882647540139
8.567415730337079
6.260504201680672
3.285863874345550
4.313767342582711
25.176484172395265
1.944444444444444
11.406299616339667
6.807191202073789
6.600614439324117
10.727712560184383
3.800197839834362
7.484484301353602
16.510067114093960
3.775697009245440
10.915711071016686
3.51752...

result:

ok 1000 numbers

Extra Test:

score: 0
Extra Test Passed