csu 1577: Dice Game

#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std; 

double sumg,sume;
int ga1,gb1,ga2,gb2,ea1,eb1,ea2,eb2; 

int main ()
{
    while (scanf("%d%d%d%d",&ga1,&gb1,&ga2,&gb2)!=EOF)
    {
        sumg = (double)(ga1+gb1)/2+(double)(ga2+gb2)/2;
        scanf ("%d%d%d%d",&ea1,&eb1,&ea2,&eb2);
        sume = (double)(ea1+eb1)/2+(double)(ea2+eb2)/2;
        if (sumg > sume)
        printf ("Gunnar\n");
        else if (sumg < sume)
        printf ("Emma\n");
        else
        printf ("Tie\n");
    }
    return 0;
}

时间: 2024-08-25 11:20:05

csu 1577: Dice Game的相关文章

csu 1577 Dice Game (博弈)

题意:有两个人 每个人可以撒两个骰子 给出每个骰子的最大和最小值 谁撒出的数值和大谁获胜 思路: 把两个人可能的值区间算出 因为是均匀分布 所以两人重叠的区间胜率相同 那么 只需计算谁获胜的区间大即可得出结果 #include<cstdio> #include<iostream> #include<cstring> #include<cmath> #include<queue> #include<stack> #include<

CSU 1265: Dice (数学啊 )

题目链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1265 Description An example of a traditional dice is a rounded cube, with each of its six faces showing a different number of dots from 1 to 6. When thrown or rolled, the dice comes to rest showin

CSU 1804: 有向无环图(拓扑排序)

http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1804 题意:…… 思路:对于某条路径,在遍历到某个点的时候,之前遍历过的点都可以到达它,因此在这个时候对答案的贡献就是∑(a1 + a2 + a3 + ... + ai) * bv,其中a是之前遍历到的点,v是当前遍历的点. 这样想之后就很简单了.类似于前缀和,每次遍历到一个v点,就把a[u]加给a[v],然后像平时的拓扑排序做就行了. 1 #include <bits/stdc++.h>

CSU 1111: 三家人【有趣的思维题】

1111: 三家人 Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 2241  Solved: 874 [Submit][Status][Web Board] Description 有三户人家共拥有一座花园,每户人家的太太均需帮忙整理花园.A 太太工作了5 天,B 太太则工作了4 天,才将花园整理完毕.C 太太因为正身怀六甲无法加入她们的行列,便出了90元.请问这笔钱如何分给A.B 二位太太较为恰当?A 应得多少元?90/(5+4)*5=$50

CSU 1112: 机器人的指令【模拟题】

1112: 机器人的指令 Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 1858  Solved: 682 [Submit][Status][Web Board] Description 数轴原点有一个机器人.该机器人将执行一系列指令,你的任务是预测所有指令执行完毕之后它的位置. ·LEFT:往左移动一个单位 ·RIGHT: 往右移动一个单位 ·SAME AS i: 和第i 条执行相同的动作.输入保证i 是一个正整数,且不超过之前执行指令数 In

CSU 1416 Practical Number

原题链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1416 结论题,具体判断方法请点击这个网址. 筛素数是肯定的,但一开始定的范围太大了,想当然要筛到10^9的质数,但仔细想想,只要到sqrt(10^9)就可以了,最后的那一个质数是最后一步的比较,不用筛出来. #include <stdio.h> #include <string.h> #include <iostream> using namespace st

CSU 1412 Line and Circles

原题链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1412 题目要求判断是否有一条直线可以穿过所有的圆. 做法:把所有圆心做一次凸包,然后判断这个凸包是否能通过一个宽度为2*R的通道. 做法和求凸包直径差不多,只是判断的时候把点到两个端点的距离换成点到直线的距离. #include <stdio.h> #include <string.h> #include <math.h> #include <stdli

CSU 1547 Rectangle(dp、01背包)

题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1547 Description Now ,there are some rectangles. The area of these rectangles is 1* x or 2 * x ,and now you need find a big enough rectangle( 2 * m) so that you can put all rectangles into it(th

CSU 1601 War (并查集)

1601: War Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 202  Solved: 58 [Submit][Status][Web Board] Description AME decided to destroy CH's country. In CH' country, There are N villages, which are numbered from 1 to N. We say two village A and B ar