답안 #15312

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
15312 2015-07-12T05:42:22 Z tonyjjw 최적의 능력 구성 (kriii3_C) C++14
62 / 62
155 ms 9276 KB
//*
#include<stdio.h>
#pragma warning(disable:4996)
#define MN 20
using namespace std;

int N;
double p[MN],d[MN];
double D[1<<MN];

bool on(int s,int i){
	return s&(1<<i);
}

int cnt(int s){
	int v=0;
	for(int i=0;i<N;i++){
		v+=on(s,i);
	}
	return v;
}

int main(){
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		scanf("%lf%lf",&p[i],&d[i]);
		p[i]/=100;
	}
	double ans=0;
	for(int s=0;s<(1<<N);s++){
		if(s==0)continue;
		double sel=(double)1/cnt(s);
		for(int i=0;i<N;i++){
			if(!on(s,i))continue;
			D[s]+=sel*( (1-p[i])*D[s-(1<<i)]+p[i]*d[i] );
		}
		if(ans<D[s])ans=D[s];
	}
	printf("%.12lf",ans);
	return 0;
}
//*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9276 KB Output is correct
2 Correct 0 ms 9276 KB Output is correct
3 Correct 0 ms 9276 KB Output is correct
4 Correct 0 ms 9276 KB Output is correct
5 Correct 0 ms 9276 KB Output is correct
6 Correct 0 ms 9276 KB Output is correct
7 Correct 0 ms 9276 KB Output is correct
8 Correct 0 ms 9276 KB Output is correct
9 Correct 0 ms 9276 KB Output is correct
10 Correct 0 ms 9276 KB Output is correct
11 Correct 0 ms 9276 KB Output is correct
12 Correct 0 ms 9276 KB Output is correct
13 Correct 0 ms 9276 KB Output is correct
14 Correct 0 ms 9276 KB Output is correct
15 Correct 0 ms 9276 KB Output is correct
16 Correct 0 ms 9276 KB Output is correct
17 Correct 0 ms 9276 KB Output is correct
18 Correct 0 ms 9276 KB Output is correct
19 Correct 0 ms 9276 KB Output is correct
20 Correct 0 ms 9276 KB Output is correct
21 Correct 0 ms 9276 KB Output is correct
22 Correct 0 ms 9276 KB Output is correct
23 Correct 0 ms 9276 KB Output is correct
24 Correct 0 ms 9276 KB Output is correct
25 Correct 0 ms 9276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 152 ms 9276 KB Output is correct
2 Correct 155 ms 9276 KB Output is correct
3 Correct 154 ms 9276 KB Output is correct
4 Correct 145 ms 9276 KB Output is correct
5 Correct 154 ms 9276 KB Output is correct
6 Correct 146 ms 9276 KB Output is correct
7 Correct 154 ms 9276 KB Output is correct
8 Correct 150 ms 9276 KB Output is correct
9 Correct 153 ms 9276 KB Output is correct
10 Correct 154 ms 9276 KB Output is correct
11 Correct 154 ms 9276 KB Output is correct
12 Correct 154 ms 9276 KB Output is correct
13 Correct 153 ms 9276 KB Output is correct
14 Correct 153 ms 9276 KB Output is correct
15 Correct 151 ms 9276 KB Output is correct
16 Correct 154 ms 9276 KB Output is correct
17 Correct 150 ms 9276 KB Output is correct
18 Correct 146 ms 9276 KB Output is correct
19 Correct 154 ms 9276 KB Output is correct
20 Correct 146 ms 9276 KB Output is correct