QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#624914 | #6423. Fireworks | lir_nut | WA | 1ms | 3920kb | C++14 | 1.1kb | 2024-10-09 16:53:47 | 2024-10-09 16:53:47 |
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 = 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;
}
printf("%.10lf", (double)(1/val(l)));
}
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: 100
Accepted
time: 0ms
memory: 3896kb
input:
3 1 1 5000 1 1 1 1 2 10000
output:
4.0000000000 10141.5852891136 3.0000000000
result:
ok 3 numbers
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3920kb
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 101.8770282124 10798.4186696285 229.7921478060 303.9373704812 153.4419337888 68.5345696432
result:
wrong answer 4th numbers differ - expected: '416.83988', found: '443.21330', error = '0.06327'