QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#703923 | #8022. Walker | QFshengxiu | WA | 0ms | 3920kb | C++23 | 1.6kb | 2024-11-02 18:53:56 | 2024-11-02 18:53:56 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
double v1,w1,v2,w2,n;
signed main(){
int t;
cin >> t;
while(t--){
cin >> n >> w1 >> v1 >> w2 >> v2;
// cout << v2 << "\n";
double mint=1e9+7;
if(w1>w2){
swap(w1,w2);
swap(v1,v2);
}
// cout << w1 << v1 << w2 << v2 << "\n";
if(w1==0 && w2==n){
cout << n/(v1+v2);
continue;
}
if(w1==0){
cout << (2*n-w2)/(v1+v2);
continue;
}
if(w2==n){
cout << (n+w1)/(v1+v2);
continue;
}
if(w1==w2){
cout << min((n-w2/v2),w1/v1);
continue;
}
//ww
double x=(w2*v1+n*v1-w1*v2)/(v2+2*v1);
// cout << x << "\n";
// cout << (x+w1)*v2 << " " << (w2+n-2*x)*v1 << "\n";
if(x<=w2){
mint=min(mint,(x+w1)/v1);
}
// cout << mint << "\n";
x=(2*n*v1-w2*v1+w1*v2)/(2*v2+v1);
if(x>=w1){
mint=min(mint,(2*x-w1)/v1);
}
mint=min({mint,(min(n+w1,n+n-w1))/v1,(min(n+w2,n+n-w2))/v2});
if(w1/v1<=(n-w1+w2-w1)/v2 && (n-w2)/v2<=(w2+w2-w1)/v1){
// cout << "qfmm" << "\n";
mint=min(mint,(w2-w1+n)/(v1+v2));
}
// cout << mint << "\n";
//1
mint=min(mint,(w2-w1+2*n)/(v1+v2));
// cout << mint << "\n";
//2
mint=min(mint,(n-w2+w1+n)/(v1+v2));
// cout << mint << "\n";
//3
double t1=(w2+w1)/(v1+v2);
double wz=abs(v1*t1-w1);
mint=min(mint,t1+min((n-wz)/v1,(n-wz)/v2));
// cout << mint << "\n";
//4
t1=(2*n-w1-w2)/(v1+v2);
// cout << t1 << " ";
wz=n-abs(w2+v2*t1-n);
mint=min(mint,t1+min(wz/v1,wz/v2));
cout << fixed << setprecision(6) << mint << "\n";
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3912kb
input:
2 10000.0 1.0 0.001 9999.0 0.001 4306.063 4079.874 0.607 1033.423 0.847
output:
5001000.000000 3827.837001
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
1 10.0 1.0 10.0 9.0 0.1
output:
1.100000
result:
ok found '1.1000000', expected '1.1000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
1 10.0 8.0 10.0 9.0 0.1
output:
1.200000
result:
ok found '1.2000000', expected '1.2000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
1 10.0 8.0 0.1 9.0 10
output:
1.100000
result:
ok found '1.1000000', expected '1.1000000', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
1 10.0 2.0 0.1 3.0 10
output:
1.300000
result:
ok found '1.3000000', expected '1.3000000', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
1 10.0 9.0 0.1 8.0 10.0
output:
1.200000
result:
ok found '1.2000000', expected '1.2000000', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
1 10.0 4.0 0.1 6.0 0.1
output:
60.000000
result:
ok found '60.0000000', expected '60.0000000', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
1 10.0 4.5 0.1 6.0 0.1
output:
57.500000
result:
ok found '57.5000000', expected '57.5000000', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
1 10.0 1.0 1.0 8.0 1.0
output:
6.500000
result:
ok found '6.5000000', expected '6.5000000', error '0.0000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
1 10.0 3.0 2.0 7.0 1.0
output:
4.600000
result:
ok found '4.6000000', expected '4.6000000', error '0.0000000'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
1 10.0 6.0 2.0 7.0 1.0
output:
3.666667
result:
ok found '3.6666670', expected '3.6666667', error '0.0000001'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
1 10.0 1.0 1.0 9.0 1.0
output:
6.000000
result:
ok found '6.0000000', expected '6.0000000', error '0.0000000'
Test #13:
score: -100
Wrong Answer
time: 0ms
memory: 3920kb
input:
1 10000.0 1.0 0.001 1.0 0.001
output:
1000
result:
wrong answer 1st numbers differ - expected: '9999000.0000000', found: '1000.0000000', error = '0.9999000'