QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#157741#7110. Kuririn MIRACLEucup-team1338#AC ✓358ms4352kbC++201.3kb2023-09-02 15:47:562023-09-02 15:47:57

Judging History

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

  • [2023-09-02 15:47:57]
  • 评测
  • 测评结果:AC
  • 用时:358ms
  • 内存:4352kb
  • [2023-09-02 15:47:56]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const double pi=acos(-1.0);
const double esp=1e-10;
struct point{//点/向量 
	double x,y;
	void in(){scanf("%lf %lf",&x,&y);}
	void out(){printf("%lf %lf\n",x,y);}
	point(double xx=0,double yy=0){x=xx,y=yy;}
};
double acs(double x){return acos(max(-1.0,min(1.0,x)));}
double f(double x){
	x=fabs(pi/2-x);
	return 1.0/(sqrt(4.0-sin(x)*sin(x))-cos(x));
} 
double simpson(double l,double r){
	double mid=(l+r)/2;
	return (f(l)+f(r)+4*f(mid))*(r-l)/6;
}
double s(double l,double r){
	double mid=(l+r)/2;
	double ansl=simpson(l,mid),ansr=simpson(mid,r);
	double ans=simpson(l,r);
	if(fabs(ans-ansl-ansr)<esp) return ansl+ansr;
	return s(l,mid)+s(mid,r);
}
double v,r,d;
bool check(double t)
{
	double x2=d-v*t;
	double ang=pi-acs(2.0*r/(x2-2*r));
	double t2=0,t3=0;
	t2+=2*r/v*s(0.0,ang);
	
	double a2=fabs(pi/2-ang);
	t3+=(x2-2*r)*cos(a2)/v/(sqrt(4.0-sin(a2)*sin(a2))-cos(a2));
	//printf("%lf %lf %lf ",t,t2,t3);
	return t2+t3<t;
}
void solve()
{
	scanf("%lf %lf %lf",&v,&r,&d);
	double L=0,R=(d-4*r)/v;
	while(R-L>esp)
	{
		//printf("%lf %lf\n",L,R);
		double mid=(L+R)/2;
		if(check(mid)) R=mid;
		else L=mid;
	}
	if(check(R)) printf("%.15lf\n",R);
	else printf("%.15lf\n",d/v);
	return;
}
int main()
{
	int t;scanf("%d",&t);
	while(t--) solve();
	return 0;
} 

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
2.00 3 30.0

output:

8.310579934048292

result:

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

Test #2:

score: 0
Accepted
time: 34ms
memory: 4352kb

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.457837122799763
5.488360809099397
5.848699763593380
1.123680241327300
43.266480053677647
8.305490138324714
2.377358490566038
4.015485969630664
37.948148148148142
18.652061855670105
4.155123643623982
27.178963007158508
9.625454545454545
63.311926605504588
16.613861386138616
15.093994461399571
1.017...

result:

ok 100 numbers

Test #3:

score: 0
Accepted
time: 358ms
memory: 4324kb

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.770882649320173
8.567415730337078
6.260504201680673
3.285863874345549
4.313767342582711
25.176484172373378
1.944444444444444
11.406299616432019
6.807191205739783
6.600614439324117
10.727712561037752
3.800197844873594
7.484484302745283
16.510067114093960
3.775697012192480
10.915711070545198
3.51752...

result:

ok 1000 numbers

Extra Test:

score: 0
Extra Test Passed