[POJ2151]Check the difficulty of problems(概率DP)


传送门

每个队之间是独立的

f[i][j]表示当前队伍前i个题答对j个的概率

满足条件的概率 == 全部方案(除去答对0)的概率 不满足条件的概率(每个队伍答对1~n1)

#include <cstdio>#include <cstring>#define N 101int m, t, n;double sum, p1, p2, f[N][N];int main()}sum = 0;for(j = 1; j < n; j++) sum += f[m][j];p1 *= 1.0  f[m][0];p2 *= sum;}printf("%.3lf\n", p1  p2);}return 0;}

  



上一篇:[BZOJ1419] Red is good(期望DP)

下一篇:[BZOJ4506] [Usaco2016 Jan]Fort Moo(DP?)


DP 概率和期望
Copyright © 2002-2019 k262电脑网 www.k262.cn 皖ICP备2020016292号
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!QQ:251442993 热门搜索 网站地图