SOJ. Dice Game

Source: Internet
Author: User

Dice Game
Total number of submissions: 100 By Quantity: 59
Time limit: 1 seconds Memory limit: 256 MB topic description

Gunnar and Emma play a lot of board in home, so they own many dice that is not normal 6-sided dice. For example they own a die that has ten sides with numbers, ..., and on it.

There had been a big storm in Stockholm, so Gunnar and Emma had been stuck at home without electricity for a couple of ho Urs. They has finished playing all the games they has, 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 is the same, the game ends in a tie.

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

All of their dice has the following Property:each die contains numbers a, a + 1, ..., b, where A and B is the lowest an D highest numbers respectively on the die. Each of the appears exactly on one side, so the die has b-a + 1 sides.

Input format

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. Assume that 1 <= ai <= bi <= 100. You can further assume this each die have at least four sides and so AI + 3 <= bi. The second line contains the description of Emma's dice in the same format.

Output format

Output the name of the player that has higher probability of winning. The Output "Tie" if both players has same probability of winning.

Sample input Copy sample input to Clipboard
Example one: 1 4 1 41 6 1 6 Sample two: 1 8 1 81 10 2 5 Sample three: 2 5 2 71 5 2 5
Sample output
Example one: Emma Sample two: tie example three: Gunnar
Problem source:2015 annual fourth game of the week
A problem with water, look at the average is good

SOJ. Dice Game

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.