QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501331 | #5152. Circular Caramel Cookie | Umok | WA | 0ms | 3796kb | C++20 | 704b | 2024-08-02 16:50:45 | 2024-08-02 16:50:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
const int N = 1e6 + 5;
#define int long long
typedef pair<int, int> PII;
#define MAX LONG_LONG_MAX
double h, r, p1, p2;
double calc(double l)
{
return h * p2 - (p2 - p1) * l;
}
void solve()
{
cin >> h >> r >> p1 >> p2;
double l = 0, r = p2 * h / (p1 + p2);
while (l + 1e-6 < r)
{
double lmid = l + (r - l) / 3;
double rmid = r - (r - l) / 3;
double x = calc(lmid);
double y = calc(rmid);
if (x < y)
r = rmid;
else
l = lmid;
}
cout << l << endl;
}
signed main()
{
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3796kb
input:
11
output:
0
result:
wrong answer 1st numbers differ - expected: '2.2360680', found: '0.0000000', error = '1.0000000'