QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#166822#7110. Kuririn MIRACLEucup-team1479WA 87ms4432kbC++141.5kb2023-09-06 18:59:402023-09-06 18:59:40

Judging History

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

  • [2023-09-06 18:59:40]
  • 评测
  • 测评结果:WA
  • 用时:87ms
  • 内存:4432kb
  • [2023-09-06 18:59:40]
  • 提交

answer

//prepare for coding{{{
#include<bits/stdc++.h>

#define RELEASE
#ifndef RELEASE
#define FL
#define DB(...) fprintf(stderr,__VA_ARGS__)
#endif 

typedef double DB;

const DB EPS=1e-8;

using namespace std;

const DB PAI=acos(-1);

inline int Read(){
	char c=getchar();
	int res=0;
	bool b=0;
	while(c>'9'||c<'0')
		b=(c=='-'),c=getchar();
	while(c>='0'&&c<='9')
		res=(res<<3)+(res<<1)+c-'0',c=getchar();
	return b?-res:res;
}

DB v,r,d;
//}}}

//solve{{{
const int B=5000;

inline DB Ftheta(DB theta){
	DB sn=sin(theta);
	return 2/(sqrt(sn*sn*4+12)-sn*2)/v;
}

inline DB Simpson(DB lim){
	DB d=lim/B,res=Ftheta(0)+Ftheta(lim);
	for(int i=1;i<B;i+=2)
		res+=4*Ftheta(i*d);
	for(int i=2;i<B;i+=2)
		res+=2*Ftheta(i*d);
	return res*d/3;
}
//}}}

//main{{{
inline void Solve(){
	scanf("%lf%lf%lf",&v,&r,&d);
	DB ll=PAI/2,rr=PAI,ans=PAI;
	while(rr-ll>EPS){
		DB mid=(ll+rr)/2,t=Simpson(mid)*r*2,alpha=atan2(sin(mid)*2*r,d-2*r-v*t+cos(mid)*2*r);
		DB x=-cos(mid)*2*r+2*EPS*cos(alpha)-EPS,y=sin(mid)*2*r-2*EPS*sin(alpha);
		if(x*x+y*y>4*r*r)
			ans=rr=mid;
		else
			ans=ll=mid;
	}
	//printf("%lf\n",ans);
	DB anst=Simpson(ans)*r*2;
	DB x=cos(ans)*2*r+d-r*2-anst*v,y=sin(ans)*2*r;
	//printf("%lf %lf %lf\n",anst,x,y);
	printf("%.10lf\n",anst+sqrt(x*x+y*y)/v/2);
}

int main(){
#ifdef FL
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	int T=Read()+1;
	while(--T)
		Solve();
	return 0;
}
//}}}
//《象》曰:泽灭木,大过。君子以独立不惧,遁世无

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4432kb

input:

1
2.00 3 30.0

output:

8.3105799339

result:

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

Test #2:

score: -100
Wrong Answer
time: 87ms
memory: 4392kb

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.4578371227
5.4883608090
19.6619708387
14.2503764451
43.2664800535
8.3054901382
5.2825895612
4.0154859695
40.6105688458
13.6188238200
4.1551236436
27.1789630071
6.1517775153
55.6333419215
26.2864008400
15.0939944612
8.8355441646
6.9496235027
8.1504302992
8.0094898462
4.9877463896
11.3473230654
18.4...

result:

wrong answer 3rd numbers differ - expected: '5.8486998', found: '19.6619708', error = '2.3617679'