QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#227806 | #2940. Pooling PCR Tests | Thallium54# | AC ✓ | 0ms | 3860kb | C++20 | 661b | 2023-10-27 23:43:43 | 2023-10-27 23:43:44 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
#define pii pair<int, int>
const int N = 2e5 + 100;
const int inf = 1e9;
const ll mod = 998244353;
const ld eq = 1e-18;
int main()
{
ld p;
cin >> p;
p = 1-p;
ld P = p;
int n = 1;
ld ans = 1;
for(int i = 2; i <= 16; i++)
{
P = P*p;
ld E = (P + i*(1-P))/ld(i);
//cout << fixed << setprecision(20) << P << ' ' << E << endl;
//cout << ans - E << endl;
if(ans - E > eq)
{
ans = E;
n = i;
}
}
cout << n << endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3748kb
input:
0.1
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
0.02
output:
8
result:
ok single line: '8'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
0.01
output:
10
result:
ok single line: '10'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
0.4
output:
2
result:
ok single line: '2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
0.24
output:
3
result:
ok single line: '3'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
0.11
output:
4
result:
ok single line: '4'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
0.061
output:
5
result:
ok single line: '5'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
0.035
output:
6
result:
ok single line: '6'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
0.025
output:
7
result:
ok single line: '7'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
0.02
output:
8
result:
ok single line: '8'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
0.015
output:
9
result:
ok single line: '9'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
0.01
output:
10
result:
ok single line: '10'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
0.009
output:
11
result:
ok single line: '11'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
0.0075
output:
12
result:
ok single line: '12'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
0.006
output:
13
result:
ok single line: '13'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
0.0055
output:
14
result:
ok single line: '14'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
0.005
output:
15
result:
ok single line: '15'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
0.0033
output:
16
result:
ok single line: '16'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
0.001
output:
16
result:
ok single line: '16'