QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#624881#6423. Fireworkslir_nutWA 1ms3960kbC++141.1kb2024-10-09 16:48:432024-10-09 16:48:43

Judging History

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

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

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*0.0001, k);
    ans /= (n * k + m);
    return ans;
}

void solution(){
    scanf("%d%d%d", &n, &m, &p);
    int l = 0, r = 1e9, 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;
    }
    printf("%.10lf", (double)(1/val(mid)));
}

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

詳細信息

Test #1:

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

input:

3
1 1 5000
1 1 1
1 2 10000

output:

4.0000000000
10141.5852891136
4.0000000000

result:

wrong answer 3rd numbers differ - expected: '3.00000', found: '4.00000', error = '0.33333'