#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);
}
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |