QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#507092#6423. FireworksUmokWA 0ms4192kbC++20967b2024-08-06 10:41:092024-08-06 10:41:10

Judging History

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

  • [2024-08-06 10:41:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4192kb
  • [2024-08-06 10:41:09]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl '\n'
const int N = 2e5 + 5;
#define int long long
typedef pair<int, int> PII;
#define MAX LONG_LONG_MAX
#define mod 10007
#define eps 1e-7
int a, b;
double p;

double calc(double mid)
{
    double x = mid * a + b;
    double y = pow(1 - (double)p / 10000, mid);
    y = 1 - y;
    return x / y;
}
void solve()
{
    cin >> a >> b >> p;
    double l = 0, r = 1e9;
    while (l + 1 < r)
    {
        double lmid = l + (double)(r - l) / 3.0;
        double rmid = r - (double)(r - l) / 3.0;

        double x = calc(lmid), y = calc(rmid);
        if (x < y)
            r = rmid;
        else
            l = lmid;
    }
    int x = round(l);
    if (x == 0)
        x++;
    printf("%.10lf\n", calc(x));
}

signed main()
{
    int t;
    cin >> t;
    while (t--)
        solve();

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4028kb

input:

3
1 1 5000
1 1 1
1 2 10000

output:

4.0000000000
10141.5852891147
3.0000000000

result:

ok 3 numbers

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 4192kb

input:

20
10 27 2855
79 59 6888
65 72 7725
78 50 2888
31 21 5759
41 58 6619
47 27 3881
35 55 5095
77 7 6028
17 89 1792
84 60 8604
58 44 4923
88 27 3824
54 63 1482
19 42 5366
93 76 97
100 99 8660
96 36 4343
90 56 9515
24 44 9922

output:

89.7298056505
200.3484320557
177.3462783172
416.8398778004
90.2934537246
149.5694213627
190.6725070858
176.6437684004
139.3497013935
277.3137564429
167.3640167364
207.1907373553
300.7322175732
589.0588489505
101.8770282124
10798.4186696284
229.7921478060
303.9373704812
153.4419337888
68.5345696432

result:

wrong answer 8th numbers differ - expected: '164.60152', found: '176.64377', error = '0.07316'