SOJ.Dice Game

1000. Dice Game
 
 
总提交数量:100通过数量:59
 
   
   
 
时间限制:1秒    内存限制:256兆
题目描述

Gunnar and Emma play a lot of board games at home, so they own many dice that are not normal 6- sided dice. For example they own a die that has 10 sides with numbers 47, 48, ..., 56 on it.

There has been a big storm in Stockholm, so Gunnar and Emma have been stuck at home without electricity for a couple of hours. They have finished playing all the games they have, so they came up with a new one. Each player has 2 dice which he or she rolls. The player with a bigger sum wins. If both sums are the same, the game ends in a tie.

Given the description of Gunnar’s and Emma’s dice, which player has higher chances of winning?

All of their dice have the following property: each die contains numbers a, a + 1, ..., b, where a and b are the lowest and highest numbers respectively on the die. Each number appears exactly on one side, so the die has b - a + 1 sides.

输入格式

The first line contains four integers a1, b1, a2, b2 that describe Gunnar’s dice. Die number i contains numbers ai, ai + 1, ..., bi on its sides. You may assume that 1 <= ai <= bi <= 100. You can further assume that each die has at least four sides, so ai + 3 <= bi. The second line contains the description of Emma’s dice in the same format.

输出格式

Output the name of the player that has higher probability of winning. Output “Tie” if both players have same probability of winning.

样例输入
将样例输入复制到剪贴板
样例一:
1 4 1 4
1 6 1 6
样例二:
1 8 1 8
1 10 2 5
样例三:
2 5 2 7
1 5 2 5
样例输出
样例一:
Emma
样例二:
Tie
样例三:
Gunnar

Problem Source: 2015年每周一赛第四场


挺水的一道题,看平均值就好
#include
           
           
            
            
using namespace std; 
int main(){
	double a,b,c,d,e,f,g,h,sum1,sum2;
	cin>>a>>b>>c>>d>>e>>f>>g>>h;
	sum1=((a+b)/2)+((c+d)/2);
	sum2=((e+f)/2)+((g+h)/2);
	if(sum1==sum2)cout<<"Tie"<
            
            
             
             sum2)cout<<"Gunnar"<
             
             
            
            
           
           

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值