QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501331#5152. Circular Caramel CookieUmokWA 0ms3796kbC++20704b2024-08-02 16:50:452024-08-02 16:50:45

Judging History

你现在查看的是最新测评结果

  • [2024-08-02 16:50:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3796kb
  • [2024-08-02 16:50:45]
  • 提交

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;
}

详细

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'