QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#867512 | #2940. Pooling PCR Tests | LaVuna47# | AC ✓ | 1ms | 3968kb | C++20 | 1.7kb | 2025-01-23 17:43:10 | 2025-01-23 17:43:10 |
Judging History
answer
//A tree without skin will surely die.
//A man without face is invincible.
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(S) ((int)S.size())
#define FOR(i, st_, n) for(int i = st_; i < n; ++i)
#define RFOR(i, n, end_) for(int i = (n)-1; i >= end_; --i)
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef unsigned long long ull;
typedef long double LD;
typedef pair<ull, ull> pull;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using namespace std;
#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif
int solve()
{
LD p;
if(!(cin>>p))return 1;
p += 1e-9;
LD res=1e9;
ll bN=-1;
FOR(N,2,17)
{
LD P=1;
FOR(i,0,N)P *= (1.-p);
LD E=P + (LD)N*(1.-P);
if(E < N && E/(LD)N < res)
{
res=E/(LD)N;
bN=N;
}
}
if(bN==-1)cout<<"1\n";
else cout<<bN<<"\n";
return 0;
}
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int TET = 1e9;
//cin >> TET;
for (int i = 1; i <= TET; i++)
{
if (solve())
{
break;
}
#ifdef ONPC
cout << "__________________________" << endl;
#endif
}
#ifdef ONPC
cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3840kb
input:
0.1
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
0.02
output:
8
result:
ok single line: '8'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
0.01
output:
10
result:
ok single line: '10'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
0.4
output:
2
result:
ok single line: '2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
0.24
output:
3
result:
ok single line: '3'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
0.11
output:
4
result:
ok single line: '4'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
0.061
output:
5
result:
ok single line: '5'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
0.035
output:
6
result:
ok single line: '6'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
0.025
output:
7
result:
ok single line: '7'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
0.02
output:
8
result:
ok single line: '8'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
0.015
output:
9
result:
ok single line: '9'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
0.01
output:
10
result:
ok single line: '10'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
0.009
output:
11
result:
ok single line: '11'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
0.0075
output:
12
result:
ok single line: '12'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
0.006
output:
13
result:
ok single line: '13'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
0.0055
output:
14
result:
ok single line: '14'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
0.005
output:
15
result:
ok single line: '15'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
0.0033
output:
16
result:
ok single line: '16'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
0.001
output:
16
result:
ok single line: '16'