QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#688270#2940. Pooling PCR Testskevinyang#WA 0ms3972kbC++17942b2024-10-30 01:57:352024-10-30 01:57:36

Judging History

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

  • [2024-10-30 01:57:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3972kb
  • [2024-10-30 01:57:35]
  • 提交

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'