Submission #15407

#TimeUsernameProblemLanguageResultExecution timeMemory
15407sujin최적의 능력 구성 (kriii3_C)C++98
0 / 62
0 ms1084 KiB
#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); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...