QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#160525 | #7110. Kuririn MIRACLE | ucup-team296# | AC ✓ | 352ms | 4332kb | C++14 | 2.8kb | 2023-09-02 20:44:07 | 2023-09-02 20:44:08 |
Judging History
answer
#include <bits/stdc++.h>
#define long long long int
#define DEBUG
using namespace std;
// @author: pashka
struct test {
double v, r, d;
double f(double x) {
return 2 * r / v / (sqrt(sin(x) * sin(x) + 3) - sin(x));
}
const int N = 10;
double integrate_simple(double l, double r) {
double res = 0;
for (int i = 0; i <= N; i++) {
double t = f(l + (r - l) * i / N);
if (i == 0 || i == N) res += t;
else if (i & 1) {
res += 4 * t;
} else {
res += 2 * t;
}
}
res *= (r - l) / N / 3;
return res;
}
double integrate(double l, double r) {
double m = (l + r) / 2;
double s1 = integrate_simple(l, r);
double s2 = integrate_simple(l, m) + integrate_simple(m, r);
if (abs(s1 - s2) < 1e-9) {
return s2;
}
return integrate(l, m) + integrate(m, r);
}
double calc(double a) {
return integrate(0, a);
}
double time(double a) {
double t = calc(a);
// double x = 2 * r + t * v + 2 * r * sin(a - M_PI / 2);
// double xx = x + 2 * r / sin(a - M_PI / 2);
// double vv = v * (sqrt(sin(a) * sin(a) + 3) - sin(a));
// double t2 = 2 * r / tan(a - M_PI / 2) / vv;
double vv = v * (sqrt(sin(a) * sin(a) + 3) - sin(a));
double vx = vv * sin(a) + v;
double vy = -vv * cos(a);
double x = 2 * r + t * v + 2 * r * sin(a - M_PI / 2);
return t + (d - x) / vx;
}
double dist(double a) {
double t = calc(a);
double vv = v * (sqrt(sin(a) * sin(a) + 3) - sin(a));
double vx = vv * sin(a) + v;
double vy = -vv * cos(a);
// cout << vx * vx + vy * vy << " " << 4 * v * v << "\n";
// double xx = 2 * r + t * v + 2 * r * 2 * v / vy;
// return xx;
double x = 2 * r + t * v + 2 * r * sin(a - M_PI / 2);
double y = 2 * r * cos(a - M_PI / 2);
return x + y / vy * vx;
}
bool good(double a) {
return dist(a) <= d;
}
void solve() {
cin >> v >> r >> d;
cout << setprecision(20);
if (!good(M_PI)) {
cout << d / v << "\n";
return;
}
double l = M_PI / 2;
double rr = M_PI;
for (int i = 0; i < 100; i++) {
double m = (l + rr) / 2;
if (good(m)) {
rr = m;
} else {
l = m;
}
}
cout << time(l) << "\n";
}
};
int main() {
ios::sync_with_stdio(false);
int n;
cin >> n;
for (int i = 0; i < n; i++) {
test().solve();
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 4244kb
input:
1 2.00 3 30.0
output:
8.3105799339131376513
result:
ok found '8.3105799', expected '8.3105799', error '0.0000000'
Test #2:
score: 0
Accepted
time: 36ms
memory: 4116kb
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.457837122855659473 5.4883608090279683012 5.8486997635933795081 1.1236802413273001555 43.266480053578533216 8.3054901382009411748 2.3773584905660376521 4.0154859695251188256 37.948148148148142411 18.652061855670105217 4.1551236436133880403 27.178963007090050752 9.6254545454545450411 63.311926605504...
result:
ok 100 numbers
Test #3:
score: 0
Accepted
time: 352ms
memory: 4332kb
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.7708826492855775925 8.5674157303370783723 6.2605042016806731198 3.2858638743455492737 4.3137673425827109952 25.176484172172475695 1.9444444444444441977 11.40629961641575818 6.8071912056906000998 6.6006144393241168444 10.727712560857920465 3.8001978448328812554 7.4844843026374263673 16.510067114093...
result:
ok 1000 numbers
Extra Test:
score: 0
Extra Test Passed