QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#624953#6423. Fireworkslir_nutWA 1ms3932kbC++141.2kb2024-10-09 16:59:422024-10-09 16:59:43

Judging History

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

  • [2024-10-09 16:59:43]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3932kb
  • [2024-10-09 16:59:42]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <set>

#define test
#ifndef test
    freopen("in.in", stdin);
#endif

#define rint register int
#define ll long long
#define P pair<int, int> 
const int N = 2e5+5;

using namespace std;
int n, m, p;
long double qpow(long double a, int x){
    long double ans = 1;
    while(x){
        if(x&1) ans*=a;
        a*=a;
        x>>=1;
    }
    return ans;
}
long double val(int k){
    long double ans = 1 - qpow(1-(long double)p/10000, k);
    ans /= (n * k + m);
    return ans;
}

void solution(){
    scanf("%d%d%d", &n, &m, &p);
    int l = 1, r = 2e9, eps = 1, lm, rm, mid;
    while(r - l > eps){
        mid = (l + r) / 2;
        lm = mid - eps;
        rm = mid + eps;
        if(val(lm) < val(rm)) l = mid;
        else r = mid;
    }
    long double ans = max(max(val(max(l-1, 1)), val(l)), max(val(l+1), val(l+2)));
    ans = val(2);
    printf("%.10lf", (double)(1/ans));
}

int main(){
    test
    int t = 1;
    scanf("%d", &t);
    while (t--){
        solution();
        if(t) printf("\n");
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3932kb

input:

3
1 1 5000
1 1 1
1 2 10000

output:

4.0000000000
15000.7500375019
4.0000000000

result:

wrong answer 2nd numbers differ - expected: '10141.58529', found: '15000.75004', error = '0.47913'