QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#163583 | #7110. Kuririn MIRACLE | ucup-team866 | AC ✓ | 297ms | 3808kb | C++14 | 1.1kb | 2023-09-04 11:42:19 | 2023-09-04 11:42:19 |
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);
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3808kb
input:
1 2.00 3 30.0
output:
8.3105799341
result:
ok found '8.3105799', expected '8.3105799', error '0.0000000'
Test #2:
score: 0
Accepted
time: 27ms
memory: 3748kb
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.4578371230 5.4883608091 5.8486997636 1.1236802413 43.2664800555 8.3054901384 2.3773584906 4.0154859696 37.9481481481 18.6520618557 4.1551236436 27.1789630073 9.6254545455 63.3119266055 16.6138613861 15.0939944615 1.0171821306 6.9496235028 8.1504302994 8.8584474886 1.7697642164 4.5411392405 10.4731...
result:
ok 100 numbers
Test #3:
score: 0
Accepted
time: 297ms
memory: 3656kb
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.7708826496 8.5674157303 6.2605042017 3.2858638743 4.3137673426 25.1764841730 1.9444444444 11.4062996166 6.8071912057 6.6006144393 10.7277125611 3.8001978449 7.4844843028 16.5100671141 3.7756970122 10.9157110710 3.5175276461 1.1753086420 6.0952874392 14.4431818182 8.4168240744 8.4894553078 6.028112...
result:
ok 1000 numbers
Extra Test:
score: 0
Extra Test Passed