QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#164584 | #7110. Kuririn MIRACLE | TsReaper | WA | 10ms | 4064kb | C++17 | 1.5kb | 2023-09-05 10:42:48 | 2023-09-05 10:42:48 |
Judging History
answer
#include <bits/stdc++.h>
#define EPS 1e-9
using namespace std;
double v, r, d, ans;
int sgn(double x) {
if (x > EPS) return 1;
if (x < -EPS) return -1;
return 0;
}
double f(double x) {
double s = sin(x);
return 1 / (sqrt(s * s + 3) - s);
}
double simpson(double l, double r) {
double mid = (l + r) / 2;
return (r - l) * (f(l) + 4 * f(mid) + f(r)) / 6;
}
double calc(double l, double r, double eps, double ans) {
double mid = (l + r) / 2;
double fl = simpson(l, mid), fr = simpson(mid, r);
if (abs(fl + fr - ans) <= 15 * eps) return fl + fr + (fl + fr - ans) / 15;
return calc(l, mid, eps / 2, fl) + calc(mid, r, eps / 2, fr);
}
void solve() {
scanf("%lf%lf%lf", &v, &r, &d);
const double PI = acos(-1);
double head = PI / 2, tail = PI;
while (tail - head > EPS) {
double mid = (head + tail) / 2;
double t = 2 * r / v * calc(0, mid, EPS, simpson(0, mid));
double x = 2 * r * (1 - cos(mid)) + v * t;
double y = 2 * r * sin(mid);
double beta = atan(y / (d - x));
double dot = (x - (2 * r + v * t)) * (2 * v * cos(beta) - v) - y * (2 * v * sin(beta));
if (sgn(dot) >= 0) {
tail = mid;
ans = t + sqrt((x - d) * (x - d) + y * y) / (2 * v);
} else {
head = mid;
}
}
ans = min(ans, d / v);
printf("%.9f\n", ans);
}
int main() {
int tcase; scanf("%d", &tcase);
while(tcase--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 4012kb
input:
1 2.00 3 30.0
output:
8.310579934
result:
ok found '8.3105799', expected '8.3105799', error '0.0000000'
Test #2:
score: -100
Wrong Answer
time: 10ms
memory: 4064kb
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.457837123 5.488360809 5.848699764 1.123680241 43.266480054 8.305490138 2.377358491 4.015485970 26.393640829 11.564446910 4.155123644 27.178963007 5.744678054 41.562490375 12.902681194 15.093994461 1.017182131 6.949623503 8.150430299 5.865060260 1.769764216 4.541139241 8.730813993 3.462229267 4.331...
result:
wrong answer 9th numbers differ - expected: '37.9481481', found: '26.3936408', error = '0.3044815'