QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#163582#7110. Kuririn MIRACLEucup-team866WA 0ms3636kbC++141.1kb2023-09-04 11:41:472023-09-04 11:41:47

Judging History

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

  • [2023-09-04 11:41:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3636kb
  • [2023-09-04 11:41:47]
  • 提交

answer

#include <bits/stdc++.h>
#include <cmath>
using namespace std;
typedef long double ld;
const ld Pi = acos(- 1.L), S3 = sqrt(3.L);
int T; ld v, r, d, L, R, M, ans;
ld f(ld a) {
	ld s = sin(a);
	return 1 / (sqrt(s * s + 3) - s);
}
ld simpson(ld l, ld r) {
	return (r - l) / 6 * (f(l) + f(r) + 4 * f((l + r) / 2));
}
ld integral(ld l, ld r, ld eps, ld ans) {
	ld mid = (l + r) / 2, lans = simpson(l, mid), rans = simpson(mid, r);
	if (fabsl(lans + rans - ans) < 15 * eps) return lans + rans;
	return eps /= 2, integral(l, mid, eps, lans) + integral(mid, r, eps, rans);
}
ld calc(ld a) {
	ld s = sin(a);
	return 2 * r / v * (integral(0, a, 1e-9, simpson(0, a)) - tan(a) / (sqrt(s * s + 3) - s));
}
bool chk(ld a) {
	return d - v * calc(a) >= 2 * r * (1 - 1 / cos(a));
}
int main() {
	cin >> T;
	while (T --) {
		scanf ("%lf%lf%lf", &v, &r, &d);
//		cin >> v >> r >> d;
		L = Pi / 2, R = Pi;
		if (! chk(R)) ans = d / v;
		else {
			for (int i=1; i<=50; i++) {
				M = (L + R) / 2;
				(chk(M) ? R : L) = M;
			} ans = calc(R);
		} printf ("%.10Lf\n", ans);
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3636kb

input:

1
2.00 3 30.0

output:

1.0037841797

result:

wrong answer 1st numbers differ - expected: '8.3105799', found: '1.0037842', error = '0.8792161'