QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#506200#6423. FireworksInk_baiWA 0ms4144kbC++20699b2024-08-05 15:57:412024-08-05 15:57:42

Judging History

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

  • [2024-08-05 15:57:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4144kb
  • [2024-08-05 15:57:41]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;

int n, m, p;
double pp;

double f(double k)
{
    return (k * n + m) / (1 - pow(pp, k));
}

signed main()
{
    int T;
    cin >> T;
    while(T--)
    {
        cin >> n >> m >> p;
        pp = 1 - p / 10000.0;
        double eps = 1e-6;
        int l = 1, r = 1e9;
        double mid, lmid, rmid;
        while (r - l > 1) {
            mid = (l + r) / 2;
            lmid = mid - eps;
            rmid = mid + eps;
            if (f(lmid) < f(rmid))
                r = mid;
            else
                l = mid;
        }
        cout << fixed << setprecision(10) << f(l) << endl;
    }
}

详细

Test #1:

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

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: 4144kb

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
443.2132963989
90.2934537246
149.5694213627
190.6725070858
176.6437684004
139.3497013935
277.3137564429
167.3640167364
207.1907373553
300.7322175732
589.0588489505
113.6787178531
10798.4186696284
229.7921478060
303.9373704812
153.4419337888
68.5345696432

result:

wrong answer 4th numbers differ - expected: '416.83988', found: '443.21330', error = '0.06327'