QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#578071#6423. Fireworkslibantian#WA 1ms4244kbC++23700b2024-09-20 16:20:282024-09-20 16:20:28

Judging History

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

  • [2024-09-20 16:20:28]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4244kb
  • [2024-09-20 16:20:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define fi first
#define se second
#define all(_a) _a.begin(),_a.end()
double n,m;
double p;
const double eps=1e-9;
double f(double x){
    return (n*x+m)*1.0/(1.0-pow(1.0-p,x));
}
void solve(){
    cin>>n>>m>>p;
    p*=1e-4;
    double l=1.0,r=1e18;
    while(r-l>eps){
        double m1=l+(r-l)/3;
        double m2=l+(r-l)/3*2;
        if(f(m1)>f(m2))l=m1;
        else r=m2;
    }

   printf("%.14lf\n",f(r));

}
signed main(){
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr),cin.tie(nullptr);
    int T=1;
    cin>>T;
    while(T--)solve();
    return 0;
}

詳細信息

Test #1:

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

input:

3
1 1 5000
1 1 1
1 2 10000

output:

3.86403792027692
10141.58526314791379
3.00000000076198

result:

wrong answer 1st numbers differ - expected: '4.00000', found: '3.86404', error = '0.03399'