QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#509398 | #8022. Walker | Xunwuqishi# | WA | 0ms | 3940kb | C++23 | 1.2kb | 2024-08-08 14:10:09 | 2024-08-08 14:10:09 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define lowbit(x) x&(-x)
#define int long long
#define double long double
const int N = 2e5+10;
double INF = 1e9;
int mod = 1e6+7;
//int mod = 1e9+7;
//int ways[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};
double n,a,b,av,bv,ans;
void solve() {
cin>>n>>a>>av>>b>>bv;
if(a > b){
swap(a,b);
swap(av,bv);
}
double t;
//-> <-
t = (b-a)/(av+bv);
ans = 2*t+max(a/av,(n-b)/bv);
ans = min(ans,(n+b-a)/(av+bv));
//<- ->
ans = min(ans,(a+n-b+n)/(av+bv));
double tb = (n-b)/bv;
double ta = a/av;
if(tb*2 < (a+b)/av) ans = min(ans, max(tb,(a+b)/av));
if(ta*2 < (n-b + n-a)/bv) ans = min(ans, max(ta,(n-b + n-a)/bv));
//<- <-
ans = min(ans,max(a/av,(b-a+n-a)/bv));
//-> ->
ans = min(ans,max((n-b)/bv,(b-a+b)/av));
ans = min(ans,(a+n)/av);
ans = min(ans,(n-a+n)/av);
ans = min(ans,(n-b+n)/bv);
ans = min(ans,(b+n)/bv);
cout<<ans<<endl;
}
signed main() {
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout<<fixed<<setprecision(10);
int caset = 1;
cin>>caset;
for(int i = 1;i<=caset;i++){
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3816kb
input:
2 10000.0 1.0 0.001 9999.0 0.001 4306.063 4079.874 0.607 1033.423 0.847
output:
5001000.0000000000 3827.8370013755
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
1 10.0 1.0 10.0 9.0 0.1
output:
1.1000000000
result:
ok found '1.1000000', expected '1.1000000', error '0.0000000'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3940kb
input:
1 10.0 8.0 10.0 9.0 0.1
output:
1.0891089109
result:
wrong answer 1st numbers differ - expected: '1.2000000', found: '1.0891089', error = '0.0924092'