QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#162920 | #7110. Kuririn MIRACLE | ucup-team1209# | WA | 78ms | 35316kb | C++20 | 1.7kb | 2023-09-03 17:46:05 | 2023-09-03 17:46:06 |
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 - R) / 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 - R) / v);
}
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 78ms
memory: 35316kb
input:
1 2.00 3 30.0
output:
8.31057993390645308781
result:
ok found '8.3105799', expected '8.3105799', error '0.0000000'
Test #2:
score: -100
Wrong Answer
time: 77ms
memory: 35140kb
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 3.56028368794326241097 -0.37707390648567119159 43.26648005353473130929 8.30549013820445342082 1.72169811320754716992 4.01548596951186993927 31.91111111111111111119 16.32731958762886597877 4.15512364357619008422 27.17896300708069039914 8.51454545454545454...
result:
wrong answer 3rd numbers differ - expected: '5.8486998', found: '3.5602837', error = '0.3912692'