QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#159165#7110. Kuririn MIRACLEucup-team1448#WA 0ms4372kbC++141.4kb2023-09-02 17:34:352023-09-02 17:34:36

Judging History

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

  • [2023-09-02 17:34:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4372kb
  • [2023-09-02 17:34:35]
  • 提交

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), 0) * 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", D / V);
            return 1;
        } 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", t);
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
2.00 3 30.0

output:

8.310563807

result:

wrong answer 1st numbers differ - expected: '8.3105799', found: '8.3105638', error = '0.0000019'