QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#163582 | #7110. Kuririn MIRACLE | ucup-team866 | WA | 0ms | 3636kb | C++14 | 1.1kb | 2023-09-04 11:41:47 | 2023-09-04 11:41:47 |
Judging History
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);
}
}
詳細信息
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'