QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#629128#2940. Pooling PCR TestsTenshi#AC ✓1ms3840kbC++23792b2024-10-11 05:31:592024-10-11 05:32:00

Judging History

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

  • [2024-10-11 05:32:00]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3840kb
  • [2024-10-11 05:31:59]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
 
#define debug(x) cerr << #x << ": " << (x) << endl
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define dwn(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define all(x) (x).begin(), (x).end()
 
#define x first
#define y second
using pii = pair<int, int>;
using ll = long long;
 
inline void read(int &x){
    int s=0; x=1;
    char ch=getchar();
    while(ch<'0' || ch>'9') {if(ch=='-')x=-1;ch=getchar();}
    while(ch>='0' && ch<='9') s=(s<<3)+(s<<1)+ch-'0',ch=getchar();
    x*=s;
}

signed main(){
	int res=1;
	double cur=1;
	double p; cin>>p;
	rep(n, 2, 16){
		double P=1;
		rep(i, 1, n) P*=(1.0-p);
		double val=P*(1.0/n-1.0);
		if(val<cur){
			cur=val;
			res=n;
		}
	}
	cout<<res;
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3692kb

input:

0.1

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3696kb

input:

0.02

output:

8

result:

ok single line: '8'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3696kb

input:

0.01

output:

10

result:

ok single line: '10'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

0.4

output:

2

result:

ok single line: '2'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

0.24

output:

3

result:

ok single line: '3'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3760kb

input:

0.11

output:

4

result:

ok single line: '4'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

0.061

output:

5

result:

ok single line: '5'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3756kb

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: 3748kb

input:

0.02

output:

8

result:

ok single line: '8'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3820kb

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: 3768kb

input:

0.009

output:

11

result:

ok single line: '11'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3696kb

input:

0.0075

output:

12

result:

ok single line: '12'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3696kb

input:

0.006

output:

13

result:

ok single line: '13'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3764kb

input:

0.0055

output:

14

result:

ok single line: '14'

Test #17:

score: 0
Accepted
time: 0ms
memory: 3768kb

input:

0.005

output:

15

result:

ok single line: '15'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

0.0033

output:

16

result:

ok single line: '16'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

0.001

output:

16

result:

ok single line: '16'