#include <cstdio>
int n,w,c[21],l[21];
double p[21],d[21],mx;
double get (int t, double k, bool on)
{
int i,m;
double r=0;
if (t==w || on)
return k*on;
for (i=1;i<=w;i++)
if (l[i])
{
m=l[i];
l[i]=0;
r += get (t+1, k*p[m]*d[m]/(100*(w-t)), 1);
r += get (t+1, k*(100-p[m])/(100*(w-t)), 0);
l[i]=m;
}
return r;
}
void go (int t, int is)
{
c[t]=is;
if (t==n)
{
w=0;
for (int i=1;i<=n;i++)
if (c[i])
l[++w]=i;
double k=get (0,1,0);
if (mx<k)
mx=k;
}
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",mx);
}
# |
결과 |
실행 시간 |
메모리 |
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 |
- |