QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#807138 | #9851. Cup of Water | dxbt | WA | 20ms | 3952kb | C++14 | 747b | 2024-12-09 19:21:33 | 2024-12-09 19:21:34 |
Judging History
answer
#include<bits/stdc++.h>
#define F(i,l,r) for(int i=(l),i##end=(r);i<=i##end;++i)
#define G(i,l,r) for(int i=(l),i##end=(r);i>=i##end;--i)
#define pii pair<int,int>
#define x first
#define y second
#define mp(x,y) make_pair(x,y)
#define ep emplace_back
using namespace std;
typedef long long ll;
long long ans=0;
mt19937 rnd(time(0));
const double mod=1<<32;
int chk(double a)
{
double ans=0;
uniform_real_distribution<> dis(.0, a);
int t=0;
while(ans<1.0000)
{
ans+=dis(rnd);
++t;
}
return t;
}
int main()
{
cin.tie(0)->sync_with_stdio(false);
int t;
cin>>t;
while(t--)
{
double p;
cin>>p;
int T=200000;ll ans=0;
F(i,1,T)ans+=chk(p);
printf("%.6lf\n",1.0*ans/T);
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 20ms
memory: 3952kb
input:
2 0.3 1.5
output:
7.329860 1.949715
result:
wrong answer 1st numbers differ - expected: '7.33322', found: '7.32986', error = '0.00046'