QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#624881 | #6423. Fireworks | lir_nut | WA | 1ms | 3960kb | C++14 | 1.1kb | 2024-10-09 16:48:43 | 2024-10-09 16:48:43 |
Judging History
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");
}
}
Details
Tip: Click on the bar to expand more detailed information
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'