QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#162923 | #7110. Kuririn MIRACLE | ucup-team1209# | AC ✓ | 94ms | 35248kb | C++20 | 1.7kb | 2023-09-03 17:47:32 | 2023-09-03 17:47:32 |
Judging History
answer
#include<bits/stdc++.h>
using std::cin;
using std::cout;
using db = long double;
using cp = std::complex<db>;
db f(db t) {
db s = std::sin(t);
return std::sqrt(3 + s * s);
}
const int N = 1e6;
const db pi = std::acos(-1);
db beg[N + 1];
db sum[N + 1];
db guess(db l, db r) {
return (f(l) + f(r) + f((l + r) / 2) * 4) / 6 * (r - l);
}
void init() {
for(int i = 0;i <= N;++i) {
beg[i] = pi / N * i;
}
for(int i = 0;i < N;++i) {
sum[i + 1] = sum[i] + guess(beg[i], beg[i + 1]);
}
}
db calc(db t) {
int p = std::upper_bound(beg, beg + N, t) - beg - 1;
db su = sum[p] + guess(beg[p], t);
su += (1 - std::cos(t));
return su / 3 * 2;
}
int main() {
std::ios::sync_with_stdio(false), cin.tie(0);
#ifdef zqj
freopen("$.in", "r", stdin);
#endif
init();
int T;
cin >> T;
for(int i = 0;i < T;++i) {
db v, R, d, V;
cin >> v >> R >> d;
d /= R;
v /= R;
R /= R;
V = v;
auto gett = [&](db ang) { return calc(ang) / v; };
db l = pi / 2 + 1e-8, r = pi - 1e-8;
// cout << gett(pi) << '\n';
// cout << gett(pi) * v + 3 * R << '\n';
if(gett(r) * v + 3 * R <= d) {
db ans = d / v;
for(int i = 0;i < 100;++i) {
db mid = (l + r) / 2;
db T = gett(mid);
cp o0 = cp(2, 0) + cp(v, 0) * T;
cp o1 = o0 + db(2) * cp(std::cos(pi - mid), std::sin(pi - mid));
cp v = cp(std::sin(mid), std::cos(mid)) * (f(mid) - std::sin(mid)) + cp(R, 0);
// cout << abs(v) << '\n';
db tm = o1.imag() / -v.imag();
if((o1 + v * tm).real() <= d) {
r = mid;
ans = std::min(ans, T + abs(o1 - cp(d, 0)) / V / 2);
} else {
l = mid;
}
}
printf("%.20Lf\n", ans);
} else {
printf("%.20Lf\n", d / v);
}
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 77ms
memory: 35248kb
input:
1 2.00 3 30.0
output:
8.31057993390645308781
result:
ok found '8.3105799', expected '8.3105799', error '0.0000000'
Test #2:
score: 0
Accepted
time: 77ms
memory: 35144kb
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.45783712273709837237 5.48836080899674417849 5.84869976359338061443 1.12368024132730015075 43.26648005353473130929 8.30549013820445342082 2.37735849056603773598 4.01548596951186993927 37.94814814814814814964 18.65206185567010309205 4.15512364357619008422 27.17896300708069039914 9.625454545454545454...
result:
ok 100 numbers
Test #3:
score: 0
Accepted
time: 94ms
memory: 35140kb
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.77088264925245363274 8.56741573033707865155 6.26050420168067226932 3.28586387434554973793 4.31376734258271077880 25.17648417205692569672 1.94444444444444444438 11.40629961637124785596 6.80719120565682649570 6.60061443932411674338 10.72771256082876001770 3.80019784482042802579 7.4844843026304639132...
result:
ok 1000 numbers
Extra Test:
score: 0
Extra Test Passed