# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
15473 |
2015-07-12T08:13:20 Z |
sujin |
최적의 능력 구성 (kriii3_C) |
C++ |
|
0 ms |
1084 KB |
#include <cstdio>
int n,w,c[21];
double as,p[21],d[21];
double get (int t, double k)
{
int i,m;
double r=0;
if (t<w)
for (i=1;i<=n;i++)
if (c[i])
{
c[i]=0;
r += k*p[i]*d[i]/100.0/(w-t);
r += get (t+1, k*(100.0-p[i])/100.0/(w-t));
c[i]=1;
}
return r;
}
void go (int t, bool y)
{
c[t]=y;
if (t==n)
{
w=0;
for (int i=1;i<=n;w+=c[i++]);
double k=get (0,1);
//printf ("%lf\n",k);
as=(as<k)?k:as;
}
else
{
go (t+1,0);
go (t+1,1);
}
}
int main ()
{
int i;
scanf ("%d",&n);
for (i=1;i<=n;i++)
scanf ("%lf%lf",p+i,d+i);
go (0,0);
printf ("%lf\n",as);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
0 ms |
1084 KB |
Output is correct |
3 |
Correct |
0 ms |
1084 KB |
Output is correct |
4 |
Correct |
0 ms |
1084 KB |
Output is correct |
5 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |