QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#704231 | #8022. Walker | QFshengxiu | WA | 25ms | 3984kb | C++23 | 1.9kb | 2024-11-02 19:34:24 | 2024-11-02 19:34:25 |
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 << max((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){
// cout << "qfmm1" << "\n";
mint=min(mint,(x+w1)/v1);
}
else mint=min(mint,(n-w2)/v2);
// cout << mint << "\n";
x=(2*n*v1-w2*v1+w1*v2)/(2*v2+v1);
if(x>=w1){
// cout << "qfmm2" << "\n";
mint=min(mint,(2*x-w1)/v1);
}
else mint=min(mint,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 << "qfmm3" << "\n";
mint=min(mint,(w2-w1+n)/(v1+v2));
}
else{
mint=min(mint,max(w1/v1,(n-w2)/v2));
// cout << "sbqf " << w1/v1 << " " << (n-w1+w2-w1)/v2 << " " << (n-w2)/v2 << " " <<(w2+w2-w1)/v1 << "\n";
}
// 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: 3984kb
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: 3852kb
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: 3876kb
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: 3936kb
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: 3920kb
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: 3876kb
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: 3876kb
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: 3920kb
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: 3936kb
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: 3976kb
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: 3920kb
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: 3920kb
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: 0
Accepted
time: 0ms
memory: 3868kb
input:
1 10000.0 1.0 0.001 1.0 0.001
output:
9.999e+06
result:
ok found '9999000.0000000', expected '9999000.0000000', error '0.0000000'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
1 10.0 5.0 1.0 5.0 1.5
output:
5
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #15:
score: -100
Wrong Answer
time: 25ms
memory: 3924kb
input:
10000 4306.063 4079.874 0.607 1033.423 0.847 8967.336 8026.500 0.398 283.019 0.876 9568.147 4481.616 0.405 800.114 0.684 9867.264 6184.040 0.312 9853.164 0.641 3344.364 730.612 0.539 1305.868 0.947 9336.180 3672.113 0.773 432.686 0.312 1468.243 59.762 0.840 1438.446 0.827 1355.133 1096.314 0.373 109...
output:
3827.837001 7999.364992 12559.335802 15415.544462 2637.698520 9931.041518 934.494301 4326.949062 5754.032890 2847.427157 10975.323628 2902.179104 24531.536364 6278.103555 1030.000000 10734.395644 1005.077029 24249.746781 9878.009946 22899.259259 12409.897778 33365.476190 3153.058733 11691.597625 201...
result:
wrong answer 4th numbers differ - expected: '15371.5507020', found: '15415.5444620', error = '0.0028620'