QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#696572 | #8022. Walker | MLK | WA | 1ms | 4020kb | C++14 | 1.0kb | 2024-10-31 23:31:57 | 2024-10-31 23:31:59 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
double n;
double p1,p2;
double v1,v2;
const double eps = 1e-8;
int main()
{
int T;
cin >> T;
while(T -- ){
cin >> n >> p1 >> v1 >> p2 >> v2;
if(p1 > p2) swap(p1,p2),swap(v1,v2);
double a1 = (p1 + n) / v1;
double a2 = (n - p1 + n) / v1;
double a3 = (p2 + n) / v2;
double a4 = (n - p2 + n) / v2;
double a5 = max((n - p2) / v2,min((p1 + p2) / v1,(p2 + p2 - p1) / v1));
double a6 = max(p1 / v1,min((n + n - p1 - p2) / v2,(p2 - p1 + n - p1) / v2));
double a7 = (n + n - p2 + p1) / (v1 + v2);
double t = (p2 - p1) / (v1 + v2),x = v1 * t;
double a8 = t + max((p1 > eps ? (x+p1)/v1 : 0),(p2 < n - eps ? (n - p1 - x) / v2 : 0));
//cout << t << ' ' << x << ' ' << max((p1 > eps ? (2*x+p1)/v1 : 0),(p2 < n - eps ? (n - p1 - p1 + p2 - x*2) / v2 : 0)) << '\n';
printf("%.20lf\n",min({a1,a2,a3,a4,a5,a6,a7,a8}));
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3944kb
input:
2 10000.0 1.0 0.001 9999.0 0.001 4306.063 4079.874 0.607 1033.423 0.847
output:
5001000.00000000000000000000 3827.83700137551613806863
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
1 10.0 1.0 10.0 9.0 0.1
output:
1.10000000000000008882
result:
ok found '1.1000000', expected '1.1000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 4016kb
input:
1 10.0 8.0 10.0 9.0 0.1
output:
1.19999999999999995559
result:
ok found '1.2000000', expected '1.2000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
1 10.0 8.0 0.1 9.0 10
output:
1.10000000000000008882
result:
ok found '1.1000000', expected '1.1000000', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 4020kb
input:
1 10.0 2.0 0.1 3.0 10
output:
1.30000000000000004441
result:
ok found '1.3000000', expected '1.3000000', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
1 10.0 9.0 0.1 8.0 10.0
output:
1.19999999999999995559
result:
ok found '1.2000000', expected '1.2000000', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 4012kb
input:
1 10.0 4.0 0.1 6.0 0.1
output:
60.00000000000000000000
result:
ok found '60.0000000', expected '60.0000000', error '0.0000000'
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 3836kb
input:
1 10.0 4.5 0.1 6.0 0.1
output:
60.00000000000000000000
result:
wrong answer 1st numbers differ - expected: '57.5000000', found: '60.0000000', error = '0.0434783'