概率 Gym 100502D Dice Game
/*
题意:两个人各掷两个骰子,给出每个骰子的最小值和最大值,其余值连续分布
问两人投掷,胜利的概率谁大
数据小,用4个for 把所有的可能性都枚举一遍,统计每一次是谁胜利
还有更简单的做法,就是四个数相加比大小,ZT说是平均值,竟然被他水过去了:)
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std; const int MAXN = 1e4 + ;
const int INF = 0x3f3f3f3f; int main(void) //Gym 100502D Dice Game
{
//freopen ("D.in", "r", stdin); int a[], b[];
for (int i=; i<; ++i)
{
scanf ("%d%d", &a[i], &b[i]);
} int cnt1 = , cnt2 = ;
for (int i=a[]; i<=b[]; ++i)
{
for (int j=a[]; j<=b[]; ++j)
{
for (int k=a[]; k<=b[]; ++k)
{
for (int l=a[]; l<=b[]; ++l)
{
if (i + j > k + l) cnt1++;
else if (i + j < k + l) cnt2++;
}
}
}
} if (cnt1 > cnt2) puts("Gunnar");
else if (cnt1 < cnt2) puts ("Emma");
else puts ("Tie"); return ;
} /*
Emma
Tie
Gunnar
*/
概率 Gym 100502D Dice Game的更多相关文章
- CodeForcesGym 100502D Dice Game
Dice Game Time Limit: 1000ms Memory Limit: 524288KB This problem will be judged on CodeForcesGym. Or ...
- LightOJ 1248 Dice (III) 概率
Description Given a dice with n sides, you have to find the expected number of times you have to thr ...
- hdu 4586 Play the Dice(概率dp)
Problem Description There is a dice with n sides, which are numbered from 1,2,...,n and have the equ ...
- Gym 101606F - Flipping Coins - [概率DP]
题目链接:https://codeforc.es/gym/101606/problem/F 题解: 假设 $f[i][j]$ 表示抛 $i$ 次硬币,有 $j$ 个硬币正面朝上的概率. 所以只有两种挑 ...
- Codeforces gym 101343 A. On The Way to Lucky Plaza【概率+逆元+精度问题】
2017 JUST Programming Contest 2.0 题目链接:http://codeforces.com/gym/101343/problem/A A. On The Way to ...
- hdu5955 Guessing the Dice Roll【AC自动机】【高斯消元】【概率】
含高斯消元模板 2016沈阳区域赛http://acm.hdu.edu.cn/showproblem.php?pid=5955 Guessing the Dice Roll Time Limit: 2 ...
- Throwing Dice(概率dp)
C - Throwing Dice Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Lig ...
- Project Euler 389 Platonic Dice (概率)
题目链接: https://projecteuler.net/problem=389 题意: 掷一个正四面体骰子,记点数为\(T\). 掷\(T\)个正六面体骰子,记点数和为\(C\). 掷\(C\) ...
- hdu 4625 Dice(概率DP)
Dice Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submi ...
随机推荐
- centos安装配置nginx
1.安装gcc yum install gcc 2.安装PCRE,zlib,OpenSSL(其中devel,是develop开发包的意思) yum install -y pcre pcre-devel ...
- linux查看python安装路径,版本号
一.想要查看ubuntu中安装的Python路径 方法一:whereis python 方法二:which python 二.想要查看ubuntu中安装的python版本号 python
- PHP中冒号、endif、endwhile、endfor这些都是什么
我们经常在wordpress一类博客程序的模板里面看到很多奇怪的PHP语法,比如:<?php if(empty($GET_['a'])): ?><font color="r ...
- (int),Int32.Parse() 和 Convert.toInt32() 的区别
在 C# 中,(int),Int32.Parse() 和 Convert.toInt32() 三种方法有何区别? int 关键字表示一种整型,是32位的,它的 .NET Framework 类型为 S ...
- 在windows下用cygwin和eclipse搭建cocos2dx的android开发环境
在windows下用cygwin和eclipse搭建cocos2dx(2.1.4)的android开发环境,2013-8-1更新. 一.准备工作 需要下载和安装以下内容,请根据自己的操作系统选择x86 ...
- Java动态加载类在功能模块开发中的作用
Java中我们一般会使用new关键字实例化对象然后调用该对象所属类提供的方法来实现相应的功能,比如我们现在有个主类叫Web类这个类中能实现各种方法,比如用户注册.发送邮件等功能,代码如下: /* * ...
- Python -- BeautifulSoup的学习使用
BeautifulSoup4.3 的使用 下载和安装 # 下载 http://www.crummy.com/software/BeautifulSoup/bs4/download/ # 解压后 使用r ...
- poj 2421 Constructing Roads 解题报告
题目链接:http://poj.org/problem?id=2421 实际上又是考最小生成树的内容,也是用到kruskal算法.但稍稍有点不同的是,给出一些已连接的边,要在这些边存在的情况下,拓展出 ...
- MFC LIST 获取行数和列数
DWORD dwStyle = dataListControl.GetExtendedStyle(); dwStyle |= LVS_EX_FULLROWSELECT;//选中某行使整行高亮(只适用与 ...
- dbVisualizer破解
下载dbvis.puk,替换C:\Program Files\DbVisualizer\lib\dbvis.jar中的文件. 替换后打开选手动的key:下载地址dbvis.license