概率 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 ...
随机推荐
- 如何用火车头采集当前页面url网址
首先创建一个标签为本文网址,勾选后面的“从网址中采集”. 选择下面的“正则提取”,点击通配符“(?<content>?)”,这样在窗口中就显示为(?<content>[\s\S ...
- 表单元素的写法及与后台php的交互
1.<select class="textEnaSty" name="Port" size="1" onchange="Ob ...
- java笔记--使用SwingWoker类完成耗时操作
使用SwingWoker类完成耗时操作: 对于Swing中的耗时操作,通常要在一个新的线程中运行,以免程序"假死". 在java6.0中,可以用SwingWoker类来完成 Swi ...
- ReactiveCocoa入门教程:第一部分
http://www.cocoachina.com/ios/20150123/10994.html 本文翻译自RayWenderlich,原文:ReactiveCocoa Tutorial--The ...
- phpcms某处储存型XSS(demo+本地演示)
文章转载:http://www.myhack58.com/Article/html/3/7/2016/71726.htm 详细说明: demo+本地演示存在xss漏洞的地方在商务中心的商家资料的我的资 ...
- sizeof()和strlen()的区别与联系
参考:http://www.cnblogs.com/carekee/articles/1630789.html 1.sizeof是运算符,其值在编译时即计算好了,参数可以是数组.指针.类型.对象.函数 ...
- Dmaven.multiModuleProjectDirectory system propery is not set.
eclipse中使用maven插件的时候,运行run as maven build的时候报错-Dmaven.multiModuleProjectDirectory system propery is ...
- mysql varchar
2013年9月13日 14:58:43 MYSQL的varchar数据类型 先说结论: 如果设置字段长度为30,字符编码为utf8,那么一个汉字算一个字符,一个数字算一个字符,一个字母也算一个字符 版 ...
- C#/Java/C/C++基本类型所占大小及表示范围
C/C++的数据类型: 一,整型 Turbo C: [signed] int 2Byte//有符号数,-32768~32767 unsigned int 2Byte //无符号数,只能表示整数 ...
- PHP--TP框架----操作数据库
//操作数据库 //$attr = $m->select(); //查询所有数据 //$attr = $m->s ...