QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#688270 | #2940. Pooling PCR Tests | kevinyang# | WA | 0ms | 3972kb | C++17 | 942b | 2024-10-30 01:57:35 | 2024-10-30 01:57:36 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
signed main() {
cin.tie(0)->sync_with_stdio(0);
double p;
cin >> p;
vector<double>pw(17);
pw[0] = 1;
for(int i = 1; i<=16; i++){
pw[i] = pw[i-1] * (1-p);
}
vector<double>ans(17);
for(int i = 1; i<=16; i++){
double cur = 1;
cur/=pw[i];
ans[i] = cur + i*(1-pw[i]);
}
bool bad = true;
for(int i = 2; i<=16; i++){
if(ans[i] < i){
bad = false;
}
}
if(bad){
cout << "1\n";
return 0;
}
cout << fixed << setprecision(10);
double mn = ans[2]/2;
int idx = 2;
for(int i = 3; i<=16; i++){
if(ans[i]/i < mn){
mn = ans[i]/i;
idx = i;
}
}
cout << idx << '\n';
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3812kb
input:
0.1
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
0.02
output:
8
result:
ok single line: '8'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3972kb
input:
0.01
output:
10
result:
ok single line: '10'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3788kb
input:
0.4
output:
1
result:
wrong answer 1st lines differ - expected: '2', found: '1'