QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#159202 | #7110. Kuririn MIRACLE | ucup-team1448# | AC ✓ | 173ms | 4252kb | C++14 | 1.4kb | 2023-09-02 17:37:25 | 2023-09-02 17:37:34 |
Judging History
answer
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using db = double;
const db eps = 1e-8;
db f(db x) { return 1 / (-sin(x) + sqrt(sin(x) * sin(x) + 3)); }
db simp(db l, db r) { return (r - l) * (f(l) + 4 * f((l + r) / 2) + f(r)) / 6; }
db asr(db l, db r, db eps, db ans, db step) {
db m = (l + r) / 2;
db fl = simp(l, m), fr = simp(m, r);
if (abs(fl + fr - ans) <= 15 * eps && step < 0)
return fl + fr + (fl + fr - ans) / 15;
return asr(l, m, eps / 2, fl, step - 1) +
asr(m, r, eps / 2, fr, step - 1);
}
db V, R, D, K;
db time(db x) { return asr(x, M_PI, eps, simp(x, M_PI), 6) * K; }
int main() {
int T;
scanf("%d", &T);
while(T--) {
scanf("%lf%lf%lf", &V, &R, &D);
R *= 2, K = R / V;
if (time(0.) * V + 2 * R > D) {
printf("%.9f\n", D / V);
} else {
db l = 0, r = M_PI_2, m, t, s;
while (r - l > eps) {
m = (l + r) / 2;
t = time(m) + R * tan(m) * f(m) / V;
s = t * V + R * (1 + 1 / cos(m));
(s > D ? r : l) = m;
// printf("%f-%f-%f %f/%f ", l / M_PI * 180, m / M_PI * 180, r / M_PI * 180, s, t);
// (s > D ? (puts("R"), r) : (puts("L"), l)) = m;
// (t > 8.310579933902352 ? (puts("R"), r) : (puts("L"), l)) = m;
}
printf("%.9f\n", t);
}
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 4160kb
input:
1 2.00 3 30.0
output:
8.310579941
result:
ok found '8.3105799', expected '8.3105799', error '0.0000000'
Test #2:
score: 0
Accepted
time: 18ms
memory: 4252kb
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.457837122 5.488360809 5.848699764 1.123680241 43.266480102 8.305490125 2.377358491 4.015485971 37.948148148 18.652061856 4.155123716 27.178962760 9.625454545 63.311926606 16.613861386 15.093994460 1.017182131 6.949623571 8.150430304 8.858447489 1.769764216 4.541139241 10.473186120 5.620603015 4.33...
result:
ok 100 numbers
Test #3:
score: 0
Accepted
time: 173ms
memory: 4220kb
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.770882672 8.567415730 6.260504202 3.285863874 4.313767343 25.176484188 1.944444444 11.406299631 6.807191144 6.600614439 10.727712553 3.800197758 7.484484299 16.510067114 3.775697008 10.915711109 3.517527648 1.175308642 6.095287441 14.443181818 8.416824119 8.489455360 6.028112337 14.641104294 0.981...
result:
ok 1000 numbers
Extra Test:
score: 0
Extra Test Passed