QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#268662 | #6423. Fireworks | yujie3 | WA | 1ms | 4208kb | C++20 | 804b | 2023-11-28 19:31:45 | 2023-11-28 19:31:45 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 7;
const double esp = 1e-7;
int n,m,k;
int a[N],b[N];
double p;
double check(double x){
return (x * n + m) / (1 - pow(1 - p,x));
}
void solve(){
cin >> n >> m;
cin >> p;
p /= 1e4;
double l = 1,r = 1e9;
while(r - l > esp){
double cnt = (r - l) / 3.0;
double mid1 = l + cnt;
double mid2 = r - cnt;
if(check(mid1) < check(mid2)){
r = mid2;
} else{
l = mid1;
}
} double ans = check(l);
printf("%.10lf\n",ans);
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr),cout.tie(nullptr);
int _; cin >> _;
while(_ --){
solve();
} return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 4208kb
input:
3 1 1 5000 1 1 1 1 2 10000
output:
3.8640379203 10141.5852631479 3.0000000000
result:
wrong answer 1st numbers differ - expected: '4.00000', found: '3.86404', error = '0.03399'