CSU1577: Dice Game

Description

CSU1577: Dice Game_第1张图片

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;
}


你可能感兴趣的:(CSU)