QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#166628 | #7110. Kuririn MIRACLE | ucup-team045 | AC ✓ | 213ms | 4356kb | C++20 | 1.9kb | 2023-09-06 15:42:29 | 2023-09-06 15:42:30 |
Judging History
answer
#include<iostream>
#include<cstring>
#include<vector>
#include<cmath>
#include<iomanip>
using namespace std;
using LL = long long;
const double PI = acos(-1);
double v, R, d;
double f(double x){
double sinx = sin(x);
return 1 / v / (sqrt(sinx * sinx + 3) - sinx);
}
const double eps = 1e-9;
double simpson(double l, double r){
double mid = (l + r) / 2;
return (r - l) * (f(l) + 4 * f(mid) + f(r)) / 6;
}
double asr(double l, double r, double eps, double st) {
double mid = (l + r) / 2;
double sl = simpson(l, mid);
double sr = simpson(mid, r);
if (abs(sl + sr - st) <= 15 * eps)
return sl + sr + (sl + sr - st) / 15;
return asr(l, mid, eps / 2, sl) + asr(mid, r, eps / 2, sr);
}
double asr(double l, double r) {
return asr(l, r, eps, simpson(l, r));
}
int main(){
#ifdef LOCAL
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
#endif
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
cout << fixed << setprecision(20);
int T;
cin >> T;
while(T--){
cin >> v >> R >> d;
auto check = [&](double mid){
double l = d - v * mid;
if (l + eps < 4 * R) return false;
double a = PI - acos(2 * R / (l - 2 * R));
double px = R * 2 - cos(a) * R * 2;
double py = sin(a) * R * 2;
double dis = sqrt((l - px) * (l - px) + py * py);
double ans = asr(0, a) * R * 2 + dis * f(a);
return ans <= mid;
};
double l = 0, r = (d - 4 * R) / v - eps;
double ans = d / v;
if (l <= r){
for(int i = 0; i < 100; i++){
double mid = (l + r) / 2;
if (check(mid)) r = mid;
else l = mid;
}
if (check(r)) ans = min(ans, r);
}
cout << ans << '\n';
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4224kb
input:
1 2.00 3 30.0
output:
8.31057993390141724888
result:
ok found '8.3105799', expected '8.3105799', error '0.0000000'
Test #2:
score: 0
Accepted
time: 20ms
memory: 4184kb
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.45783712273524912462 5.48836080898513500870 5.84869976359337950811 1.12368024132730015552 43.26648005352993209272 8.30549013820238712924 2.37735849056603765206 4.01548596950507086234 37.94814814814814241117 18.65206185567010521709 4.15512364356937347054 27.17896300707924694962 9.625454545454545041...
result:
ok 100 numbers
Test #3:
score: 0
Accepted
time: 213ms
memory: 4356kb
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.77088264925039151620 8.56741573033707837226 6.26050420168067311977 3.28586387434554927367 4.31376734258271099520 25.17648417203901090033 1.94444444444444419773 11.40629961636972922179 6.80719120563112323197 6.60061443932411684443 10.72771256081806612315 3.80019784481176081670 7.4844843026256615559...
result:
ok 1000 numbers
Extra Test:
score: 0
Extra Test Passed