概率 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 ...
随机推荐
- IOS model的getter和setter方法
总结: 当使用 self.str1 = @"xxx";时, 系统自动调用 setter方法 param_str = self.str1; 自动调用getter方法注意: 只在对象点 ...
- Linux常用热键(持续更新)
(这些文章都是从我的个人主页上粘贴过来的,大家也可以访问我的主页 www.iwangzheng.com) --圣诞节怎么过, --略过. 今天装ubuntu的时候把windows覆盖了, 凌乱,TX童 ...
- 练习英语ing——[POJ1004]Financial Management
[POJ1004]Financial Management 试题描述 Larry graduated this year and finally has a job. He's making a lo ...
- 对大一新生开始学习C语言课程谈几点看法
大家好,首先祝贺大家进入了大学,迈入了大学的校门,也意味着开始了新的征程,希望大家能够有一个美好的大学四年. 先做下自我介绍,我叫李帅阳,(大家可以称呼我 李老师,或是班助,或是...)这是在邹欣老师 ...
- 2015安徽省赛 C.LU的困惑
题目描述 Master LU 非常喜欢数学,现在有个问题:在二维空间上一共有n个点,LU每连接两个点,就会确定一条直线,对应有一个斜率.现在LU把平面内所有点中任意两点连线,得到的斜率放入一个集合中( ...
- html 构建响应式网站之viewport的使用
在网页代码的头部,加入一行viewport元标签 <!DOCTYPE html> <html lang="en"> <head> <met ...
- 二级域名session 共享方案
二级域名session 共享方案 1.利用COOKIE存放session_id(); 实例: 域名一文件php代码: <?php session_start(); setcookie(&qu ...
- 生成PHP数组文件
1. 解释型语言的妙处之一,在于可以动态生成代码再调用执行~2. 对于数据量不大(几千条?)的(key,value),存成数组文件,执行查找操作,效率应该是好于数据库操作的:3. php的数组,是ha ...
- C# Dictionary和Dynamic类型
开发中需要传递变参,考虑使用 dynamic 还是 Dictionary(准确地说是Dictionary<string,object>).dynamic 的编码体验显著优于 Diction ...
- String是引用类型
关于String为值类型还是引用类型的讨论一直没有平息,最近一直在研究性能方面的问题,今天再次将此问题进行一次明确.希望能给大家带来点帮助. 如果有错误请指出. 来看下面例子: //值类型 ; int ...