CodeForces 464D World of Darkraft - 2 (概率)
来源:互联网 发布:网络平台推广合同范本 编辑:程序博客网 时间:2024/05/18 16:38
#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>#include <cmath>#include <vector>using namespace std;#define N 100020#define B 800double dp[2][B];int n, k;int main() {scanf("%d%d", &n, &k);dp[0][1] = 0;for(int i = 1; i <= n; ++i) {int cur = i & 1 ^ 1;int nxt = cur ^ 1;for(int t = 1; t + 1 < B; ++t) {dp[nxt][t] = dp[cur][t+1] + t * dp[cur][t] + (t * t + 0.0 + 3 * t) / 2;dp[nxt][t] /= k * (t + 1);dp[nxt][t] += (k - 1.0) / k * dp[cur][t];}}printf("%.12lf\n", dp[n & 1][1] * k);return 0;}
0 0
- codeforces 464D World of Darkraft - 2 (概率dp)
- CodeForces 464D World of Darkraft - 2 (概率)
- CodeForces 464D World of Darkraft - 2 概率DP 近似计算
- 【Codeforces 138D】World of Darkraft
- codeforces 148D Bag of mice (概率)
- Codeforces 148D D Bag of mice(概率dp)
- codeforces 148D D. Bag of mice(概率dp)
- Codeforces 148D D Bag of mice(概率dp1)
- Codeforces Round #105 (Div. 2) (D. Bag of mice(概率DP))
- codeforces 148D Bag of mice DP 概率
- Codeforces 148D - Bag of mice 概率dp
- CodeForces 148D Bag of mice —— 概率DP
- codeforces-148D-Bag of mice-概率DP
- codeforces 148 D Bag of mice(概率dp)
- codeforces 148 D. Bag of mice(概率dp)
- codeforces 148 D. Bag of mice 概率dp
- Codeforces 148D Bags of mice 概率dp
- Codeforces 148D Bag of mice 概率dp(水
- 用Flume采集多台机器上的多种日志并存储于HDFS
- Python操作sqllite3
- JAVA之旅(二十五)——文件复制,字符流的缓冲区,BufferedWriter,BufferedReader,通过缓冲区复制文件,readLine工作原理,自定义readLine
- 一款好用的tomcat插件---TomcatPlugin插件
- git 系统中 post-receive 钩子不能正常执行 git pull 解决方法
- CodeForces 464D World of Darkraft - 2 (概率)
- 个人学习java的一些技巧!
- 设计模式—策略模式
- 51 NOD 1315 合法整数集(思维 + 模拟)
- Maven 目录结构
- PCI9054芯片的型号说明及购买建议
- Linux内核---18.platfrome_device与platform_driver的注册过程分析
- 十分钟搞定pandas
- WinRAR 5.21 正式版 (简体中文)