This page is still under construction.

Parts of this page are still being built. What you see may change.

Mia

Time limit1sMemory limit1024 MB

Summary
Given two dice rolls for each player, decide who wins under Mia scoring: Mia is highest, then doubles, then the larger digit first.
Level

Easy2 of 10

Topics
Implementation
Solved
No attempts yet

Problem

Mia is a dice game for two players. Each roll consists of two dice. Mia involves bluffing about what a player has rolled, but this problem focuses only on its scoring rules. Unlike most other dice games, the score of a roll is not simply the sum of the dice.

A roll is scored as follows:

  • Mia (12 or 21) is always the highest.
  • Next come doubles (11, 22, and so on). Ties are broken by value, with 66 the highest.
  • All remaining rolls are sorted so that the higher number comes first, forming a two-digit number. The value of the roll is the value of that number. For example, 3 and 4 become 43.

Input

The input contains multiple test cases. Each test case is a single line with four integers s0 s1 r0 r1, where s0 and s1 are the dice rolled by player 1 and r0 and r1 are the dice rolled by player 2. The input ends with a line containing four zeros.

Output

For each test case, print which player won, or whether the game was a tie, in exactly this format: Player 1 wins., Player 2 wins., or Tie.

Examples1

  1. Example 1

    Input
    1 2 1 3
    3 3 2 1
    6 6 4 4
    6 5 1 1
    4 2 2 4
    0 0 0 0
    
    Expected output
    Player 1 wins.
    Player 2 wins.
    Player 1 wins.
    Player 2 wins.
    Tie.