Submission #15473

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