Description
Input
Output
Sample Input
1 4 1 41 6 1 6
Sample Output
Emma
HINT
Source
NCPC 2014
Test instructions: Two people throw dice, each has two dice, to the size of the outstanding son, ask who win face bigger
Idea: Originally intended to use expectations, but then feel directly to take the middle and see who big can
#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 longconst double pi = acos (-1.0); # Define Len 20005#define mod 19999997const 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 = XY; if (fabs (x) <exp) printf ("tie\n"); else if (x>0) printf ("gunnar\n"); else printf ("emma\n"); } return 0;}
Csu1577:dice Game