CSU1577: Dice Game

Description

Input

Output

Sample Input

1 4 1 4
1 6 1 6

Sample Output

Emma

HINT

Source

NCPC 2014

题意:两个人丢色子,每人有两个色子,给出色子的大小,要求谁的赢面更大

思路:本来是打算用期望求的,但是后来觉得直接取中间的和看谁大即可

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
#define ls 2*i
#define rs 2*i+1
#define up(i,x,y) for(i=x;i<=y;i++)
#define down(i,x,y) for(i=x;i>=y;i--)
#define mem(a,x) memset(a,x,sizeof(a))
#define w(a) while(a)
#define LL long long
const double pi = acos(-1.0);
#define Len 20005
#define mod 19999997
const int INF = 0x3f3f3f3f;
#define exp 1e-6

int main()
{
    double a,b,c,d,e,f,g,h,x,y;
    w(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f,&g,&h))
    {
        x = (a+b)/2+(c+d)/2;
        y = (e+f)/2+(g+h)/2;
        x = x-y;
        if(fabs(x)<exp)
        printf("Tie\n");
        else if(x>0)
        printf("Gunnar\n");
        else
        printf("Emma\n");
    }

    return 0;
}
时间: 2024-08-09 14:52:44

CSU1577: Dice Game的相关文章

ACM学习历程—HDU 5012 Dice(ACM西安网赛)(bfs)

Problem Description There are 2 special dices on the table. On each face of the dice, a distinct number was written. Consider a1.a2,a3,a4,a5,a6 to be numbers written on top face, bottom face, left face, right face, front face and back face of dice A.

HDOJ 5012 Dice

BFS爆搜 Dice Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 284    Accepted Submission(s): 166 Problem Description There are 2 special dices on the table. On each face of the dice, a distinct nu

HDU 4652 Dice (概率DP)

Dice Problem Description You have a dice with m faces, each face contains a distinct number. We assume when we tossing the dice, each face will occur randomly and uniformly. Now you have T query to answer, each query has one of the following form: 0

CodeForcesGym 100502D Dice Game

Dice Game Time Limit: 1000ms Memory Limit: 524288KB This problem will be judged on CodeForcesGym. Original ID: 100502D64-bit integer IO format: %I64d      Java class name: (Any) Gunnar and Emma play a lot of board games at home, so they own many dice

Spring-1-F Dice(HDU 5012)解题报告及测试数据

Dice Time Limit:1000MS     Memory Limit:65536KB Description There are 2 special dices on the table. On each face of the dice, a distinct number was written. Consider a 1.a 2,a 3,a 4,a 5,a 6 to be numbers written on top face, bottom face, left face, r

hdu 5012 Dice

Dice Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 440    Accepted Submission(s): 259 Problem Description There are 2 special dices on the table. On each face of the dice, a distinct number w

HDU - 5012 Dice(BFS)

Problem Description There are 2 special dices on the table. On each face of the dice, a distinct number was written. Consider a1.a2,a3,a4,a5,a6 to be numbers written on top face, bottom face, left face, right face, front face and back face of dice A.

Hdu 4386 Play the Dice 解题报告

hdu 4586---Play the dice 解题思路:概率 题目描述:一个骰子有n面,每面朝上的概率相同,并且每一面上面都有一个数字,其中有m面是彩色的,代表掷到彩色面的时还可以继续掷下去,问最终掷得的数字的期望是多少? 解题方法: 方法一:只考虑单独掷每一次的情况,可以发现,每次掷到的期望是和先前无关的,假设a=sum/n(每掷一次的期望都是a),比如:掷第一次的时候期望是a,掷第二次的时候期望便是(m/n)*a,因为有(m/n)的概率能够掷第二次..依次可以继续下去,等比求和即可. u

1248 - Dice (III)

  PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 32 MB Given a dice with n sides, you have to find the expected number of times you have to throw that dice to see all its faces at least once. Assume that the dice is fair, that m