QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#209978 | #7110. Kuririn MIRACLE | PetroTarnavskyi | AC ✓ | 207ms | 4444kb | C++17 | 1.7kb | 2023-10-10 20:43:28 | 2023-10-10 20:43:28 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
const int M = 10000;
const db PI = acos(-1.0);
const db EPS = 1e-7;
void solve()
{
db v, r, d;
cin >> v >> r >> d;
db ans = d / v;
const db dt = ans / M;
if (dt > 0)
{
db phiP = PI - v / (2 * r) * sqrt(3) * dt, phiPP = PI;
FOR(i, 2, M + 1)
{
db t = i * dt;
db siP = sin(phiP);
db der = -v / (2 * r) * (sqrt(3 + siP * siP) - siP);
db phi = phiPP + 2 * dt * der;
db si = sin(phi), co = cos(phi);
db a = d - 2 * r - v * t, b = a - 2 * r * co;
if (abs(b) < EPS && phi < EPS)
{
ans = t;
break;
}
if (b < -EPS)
break;
if (phi < PI / 2)
{
db l = sqrt(4 * r * r + a * a - 4 * r * a * cos(phi));
db siBeta = 2 * r * si / l;
assert(0 <= siBeta && siBeta < 1 + EPS);
db beta = asin(min(1.0, siBeta));
if (phi + beta <= PI / 2 && 2 * cos(phi + beta) >= cos(phi))
{
ans = min(ans, t + l / (2 * v));
break;
}
}
else if (phi < EPS)
{
ans = t + a / (2 * v);
break;
}
phiPP = phiP;
phiP = phi;
}
}
cout << ans << "\n";
//cerr << ans - 8.310579933902352 << "\n";
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(15);
int t;
cin >> t;
while (t--)
solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 4444kb
input:
1 2.00 3 30.0
output:
8.310579760898841
result:
ok found '8.3105798', expected '8.3105799', error '0.0000000'
Test #2:
score: 0
Accepted
time: 22ms
memory: 4424kb
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.457837290612261 5.488360729705789 5.848699763593380 1.123680241327300 43.266478227526918 8.305490409167358 2.377358490566038 4.015485916645825 37.948148148148142 18.652061855670105 4.155123200171671 27.178960966362137 9.625454545454545 63.311926605504588 16.613861386138616 15.093994872077522 1.017...
result:
ok 100 numbers
Test #3:
score: 0
Accepted
time: 207ms
memory: 4436kb
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.770882445382461 8.567415730337078 6.260504201680673 3.285863874345549 4.313767342582711 25.176483674576584 1.944444444444444 11.406299012440357 6.807191695733367 6.600614439324117 10.727712388032483 3.800197498630224 7.484484149877215 16.510067114093960 3.775696789274615 10.915711506482459 3.51752...
result:
ok 1000 numbers
Extra Test:
score: 0
Extra Test Passed