QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#371654#6423. FireworksCaptainflyWA 1ms3936kbC++201.1kb2024-03-30 14:47:432024-03-30 14:47:44

Judging History

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

  • [2024-03-30 14:47:44]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3936kb
  • [2024-03-30 14:47:43]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> PII;
ld qpow(ld a, ll b)
{
    ld res = 1;
    assert(b >= 0);
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = res * a;
        a = a * a;
    }
    return res;
}
#define maxn 200010
ld n, m, p;
ld check(int x)
{
    ld p1 = 1 - p;
    p1 = 1 - qpow(p1, x);
    p1 = 1 / p1 * (n * x + m);
    return p1;
}
const ld eps=1e-18;
void solve()
{

    scanf("%Lf%Lf%Lf",&n,&m,&p);
    p /= 10000;
    int l = 1, r = 1e12;
    while (l < r)
    {
        int k = (r - l) / 3;
        int mid1 = l + k;
        int mid2 = l + k * 2;
        if (check(mid1)-check(mid2) > eps)
        {
            l = mid1 +1;
        }
        else
        {
            r = mid2;
        }
    }
    //cout<<l<<endl;
    printf("%.6Lf\n",check(l));
}
int main()
{
    // ios::sync_with_stdio(false);
    // cin.tie(0);
    // cout.tie(0);
    int t = 1;
    scanf("%d",&t);
    while (t--)
        solve();
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3936kb

input:

3
1 1 5000
1 1 1
1 2 10000

output:

4.000000
10141.589499
3.000000

result:

ok 3 numbers

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3904kb

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.729806
200.348432
177.346278
443.213296
90.293454
149.569421
190.672507
176.643768
139.349701
277.313756
167.364017
207.190737
300.732218
589.058849
113.678718
10798.418670
229.792148
303.937370
153.441934
68.534570

result:

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