标签:log 感受 了解 using lin def pre 如何 logs
//It is coded by ning_mew on 7.21
#include<bits/stdc++.h>
#define db double
using namespace std;
const int maxk=105,maxn=20;
int n,K;
int sta[maxn],s[maxn];
db dp[maxk][(1<<15)+100];
int main(){
scanf("%d%d",&K,&n);
for(int i=1;i<=n;i++){
int box=0;
scanf("%d",&s[i]);
while(1){
scanf("%d",&box);if(!box)break;
sta[i]=(sta[i]|(1<<(box-1)));
}
}
for(int i=K;i>=1;i--){
for(int j=0;j<=(1<<n)-1;j++){
for(int k=1;k<=n;k++){
if((sta[k]&j)!=sta[k]){dp[i][j]=dp[i][j]+dp[i+1][j]/n;continue;}
dp[i][j]=dp[i][j]+1.0*max(dp[i+1][j],dp[i+1][j|(1<<(k-1))]+s[k])/n;
}
}
}printf("%0.6f\n",dp[1][0]);return 0;
}
博主蒟蒻,随意转载。但必须附上原文链接:http://www.cnblogs.com/Ning-Mew/,否则你会场场比赛暴0!!!
【题解】 bzoj1076: [SCOI2008]奖励关 (装压+期望dp)
标签:log 感受 了解 using lin def pre 如何 logs
原文地址:https://www.cnblogs.com/Ning-Mew/p/9347977.html