CodeForces 175D Plane of Tanks: Duel (概率)
来源:互联网 发布:ubuntu安装VPN Client 编辑:程序博客网 时间:2024/06/05 17:50
#include <iostream>#include <cstdio>#include <vector>#include <cstring>#include <cmath>using namespace std;#define N 100020#define T 5030#define eps 1e-8int hp0, dt0, l0, r0;int hp1, dt1, l1, r1;double p0, p1;double f0[220], f1[220];bool att(double f[220], int l, int r, double p) {bool ret = 0;for(int i = 1; i <= 200; ++i) {if(f[i] < 1e-12) continue;ret = 1;for(int j = l; j <= r; ++j) {f[max(i - j, 0)] += f[i] * (1 - p) / (r - l + 1);}f[i] *= p;}return ret;}int main() {scanf("%d%d%d%d%lf", &hp0, &dt0, &l0, &r0, &p0);scanf("%d%d%d%d%lf", &hp1, &dt1, &l1, &r1, &p1);p0 /= 100, p1 /= 100;if(p0 > 0.999) {puts("0");return 0;}if(p1 > 0.999) {puts("1");return 0;}f0[hp0] = 1;f1[hp1] = 1;int t0 = 0, t1 = 0;double ans = 0;while(1) {if(t0 <= t1) {t0 += dt0;f1[0] = 0;att(f1, l0, r0, p0);ans += (1 - f0[0]) * f1[0];}else {t1 += dt1;if(!att(f0, l1, r1, p1)) break;}}printf("%.12lf\n", ans);return 0;}
0 0
- CodeForces 175D Plane of Tanks: Duel (概率)
- Plane of Tanks: Pro
- CodeFroces 175B. Plane of Tanks: Pro (构造)
- Codeforce Round #115 Plane of Tanks: Pro
- 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 322D Ciel and Duel【思维+费用流】
- 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(水
- Android学习笔记001-Android五大布局-2016.7.17
- android动画详解(一)
- Android必知必会-发布开源 Android 项目注意事项
- Session中merge和update的区别
- POJ-2387 Til the Cows Come Home
- CodeForces 175D Plane of Tanks: Duel (概率)
- 二分法新姿势
- 找素数的一点思考
- javacard DES算法API使用示例
- sphinx的安装配置和中文分词包coreseek
- Android sharedUserId研究
- 抽象类、接口和final
- 深度学习(Deep Learning)读书思考五:卷积神经网络(CNN)
- Activity的启动模式及应用场景