QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#768631 | #8022. Walker | surenjamts# | WA | 0ms | 3976kb | C++20 | 960b | 2024-11-21 13:04:19 | 2024-11-21 13:04:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define S second
#define F first
void solve(){
double n;
cin >> n;
pair<double, double> p1, p2;
cin >> p1.F >> p1.S >> p2.F >> p2.S;
if(p1.F > p2.F) swap(p1, p2);
double ans = (n + min(p1.F , n - p1.F)) / p1.S;
// cout << p1.F << " " << n - p1.F << '\n';
// cout << ans << '\n';
ans = min(ans, (n + min(p2.F, n - p2.F))/ p2.S);
// cout << ans << '\n';
ans = min(ans, max(p2.F / p2.S , (n - p1.F) / p1.S));
// cout << ans << '\n';
ans = min(ans, (2 * n - abs(p2.F - p1.F)) / (p1.S + p2.S));
ans = min(ans, max(p1.F / p1.S , (n - p1.F + n - p2.F) / p2.S));
ans = min(ans, max((n - p2.F) / p2.S, (p1.F + p2.F) / p1.S));
cout << setprecision(18) << ans << '\n';
}
int main(){
ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
int t; cin >> t; while(t--) solve();
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3972kb
input:
2 10000.0 1.0 0.001 9999.0 0.001 4306.063 4079.874 0.607 1033.423 0.847
output:
5001000 3827.83700137551614
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
1 10.0 1.0 10.0 9.0 0.1
output:
1.10000000000000009
result:
ok found '1.1000000', expected '1.1000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
1 10.0 8.0 10.0 9.0 0.1
output:
1.19999999999999996
result:
ok found '1.2000000', expected '1.2000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
1 10.0 8.0 0.1 9.0 10
output:
1.10000000000000009
result:
ok found '1.1000000', expected '1.1000000', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
1 10.0 2.0 0.1 3.0 10
output:
1.30000000000000004
result:
ok found '1.3000000', expected '1.3000000', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
1 10.0 9.0 0.1 8.0 10.0
output:
1.19999999999999996
result:
ok found '1.2000000', expected '1.2000000', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
1 10.0 4.0 0.1 6.0 0.1
output:
60
result:
ok found '60.0000000', expected '60.0000000', error '0.0000000'
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 3844kb
input:
1 10.0 4.5 0.1 6.0 0.1
output:
60
result:
wrong answer 1st numbers differ - expected: '57.5000000', found: '60.0000000', error = '0.0434783'