QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#207997 | #5151. Bottle Flip | Minhho | AC ✓ | 1ms | 3816kb | C++20 | 749b | 2023-10-09 02:52:06 | 2023-10-09 02:52:07 |
Judging History
answer
#define taskname "B"
#include <bits/stdc++.h>
#define ld long double
using namespace std;
const ld eps = 1e-6;
ld h, r, da, dw;
inline ld cal(ld x)
{
ld num = dw * x * x / 2 + da * (h * h / 2 - x * x / 2);
ld den = dw * x + da * (h - x);
return num/den;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
cin>>h>>r>>da>>dw;
ld lo = 0, hi = h;
for (int i=1; i<=1000; i++)
{
ld mid = (lo+hi)/2;
ld h1 = cal(mid), h2 = cal(mid+eps);
// cerr<<fixed<<setprecision(10)<<"CAL: "<<mid<<" "<<mid+eps<<" "<<h1<<" "<<h2<<"\n";
if (h2 >= h1) hi = mid;
else lo = mid;
}
cout<<fixed<<setprecision(10)<<lo;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3700kb
input:
22 4 1 4
output:
7.3333328333
result:
ok found '7.3333328', expected '7.3333333', error '0.0000001'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
7 2 655 988
output:
3.1415936720
result:
ok found '3.1415937', expected '3.1415942', error '0.0000002'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
1 1 1 2
output:
0.4142130624
result:
ok found '0.4142131', expected '0.4142136', error '0.0000005'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1000 1000 999 1000
output:
499.8749247421
result:
ok found '499.8749247', expected '499.8749375', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
1000 1000 1 1000
output:
30.6534295317
result:
ok found '30.6534295', expected '30.6534300', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
1 1000 1 1000
output:
0.0306529300
result:
ok found '0.0306529', expected '0.0306534', error '0.0000005'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
1000 1000 482 483
output:
499.7409252545
result:
ok found '499.7409253', expected '499.7409326', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
1 1000 482 483
output:
0.4997404326
result:
ok found '0.4997404', expected '0.4997409', error '0.0000005'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
1 1000 1 2
output:
0.4142130624
result:
ok found '0.4142131', expected '0.4142136', error '0.0000005'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
1000 1000 1 2
output:
414.2135617983
result:
ok found '414.2135618', expected '414.2135624', error '0.0000000'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
961 1000 979 983
output:
480.0101838243
result:
ok found '480.0101838', expected '480.0101932', error '0.0000000'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
997 1000 977 983
output:
497.7369837958
result:
ok found '497.7369838', expected '497.7369880', error '0.0000000'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
1 928 1 66
output:
0.1096000908
result:
ok found '0.1096001', expected '0.1096006', error '0.0000005'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3708kb
input:
1 928 2 88
output:
0.1310053042
result:
ok found '0.1310053', expected '0.1310058', error '0.0000005'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
1 928 3 74
output:
0.1676004074
result:
ok found '0.1676004', expected '0.1676009', error '0.0000005'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
1 928 3 41
output:
0.2129083554
result:
ok found '0.2129084', expected '0.2129089', error '0.0000005'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
1 928 1 12
output:
0.2240087377
result:
ok found '0.2240087', expected '0.2240092', error '0.0000005'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
2 928 89 93
output:
0.9890091617
result:
ok found '0.9890092', expected '0.9890097', error '0.0000005'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
7 928 51 72
output:
3.1990093767
result:
ok found '3.1990094', expected '3.1990099', error '0.0000002'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
722 547 709 752
output:
355.6863913153
result:
ok found '355.6863913', expected '355.6863918', error '0.0000000'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
242 742 518 920
output:
103.7429029633
result:
ok found '103.7429030', expected '103.7429035', error '0.0000000'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
873 701 43 201
output:
276.0875553400
result:
ok found '276.0875553', expected '276.0875558', error '0.0000000'
Test #23:
score: 0
Accepted
time: 1ms
memory: 3760kb
input:
268 228 527 562
output:
131.8460913863
result:
ok found '131.8460914', expected '131.8460919', error '0.0000000'
Test #24:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
312 558 341 839
output:
121.4683845753
result:
ok found '121.4683846', expected '121.4683851', error '0.0000000'
Test #25:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
274 85 178 364
output:
112.7564901897
result:
ok found '112.7564902', expected '112.7564907', error '0.0000000'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
641 539 341 977
output:
238.0544382267
result:
ok found '238.0544382', expected '238.0544387', error '0.0000000'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
245 861 438 872
output:
101.6183834214
result:
ok found '101.6183834', expected '101.6183839', error '0.0000000'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
640 181 156 606
output:
215.4198343896
result:
ok found '215.4198344', expected '215.4198349', error '0.0000000'