QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#501532 | #5151. Bottle Flip | cloudsss | WA | 0ms | 3932kb | C++20 | 596b | 2024-08-02 20:13:55 | 2024-08-02 20:13:56 |
Judging History
answer
#include<bits/stdc++.h>
#define INF 200010
#define mod 80112002
#define pi 3.14159265359
using namespace std;
typedef long long LL;
double h,r,pa,pw;
double check(double x)
{
return (x*x*pw+(h-x)*(h+x)*pa)/(x*pw+(h-x)*pa)*0.5;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>h>>r>>pa>>pw;
double l=0,r=h;
while((r-l)>1e-7)
{
double mid=(l+r)/2;
if(check(mid)<check(mid+1e-7))
r=mid;
else
l=mid;
}
cout<<fixed<<setprecision(10)<<(l+r)/2;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3816kb
input:
22 4 1 4
output:
7.3333332650
result:
ok found '7.3333333', expected '7.3333333', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
7 2 655 988
output:
3.1415941678
result:
ok found '3.1415942', expected '3.1415942', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
1 1 1 2
output:
0.4142135084
result:
ok found '0.4142135', expected '0.4142136', error '0.0000001'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3932kb
input:
1000 1000 999 1000
output:
499.9494339281
result:
wrong answer 1st numbers differ - expected: '499.8749375', found: '499.9494339', error = '0.0001490'