UTS Programming Competition 2013 Problem 6

From ProgSoc Wiki

Jump to: navigation, search

Problem 6: Infinity Scrabble

Problem Description

Eight mathematicians are playing Infinity Scrabble, a game for ages 5 to 5^3 (distributed by Knuth Boardgames). This is a game where players have to make the largest number possible using only single digits 3,4,5,6,7,8,9 and carat symbols (^).

Players receive seven random pieces; a mixture of "3", "4", "5", "6", "7", "8", "9", and "^".

Players are entitled to two carats — if they only receive one, they can substitute a piece.

Here is how the the numbers are created:

5 + (5 + (5 + 5)) = 5x4
5 x (5 x (5 x 5)) = 5^4
5 ^ (5 ^ (5 ^ 5)) = 5^^4
5 ^^(5 ^^(5 ^^5)) = 5^^^4
5^^^(5^^^(5^^^5)) = 5^^^^4 ... 

and so on.

Problem Task

Your job is to create a judging algorithm to take a list of answers each player makes, and rearrange the list in order from smallest to largest. The winner is the largest, the last entry in the list.

Each player's answer consists of two digits between 3 and 9 inclusive, separated by two or three or four or five carats. Each answer is separated by a comma.

Sample Input

3^^^3,9^^9,3^^^4,9^^^3,5^^^4,4^^^^4,6^^7,7^^6

Sample Output

7^^6,6^^7,9^^9,3^^^3,9^^^3,3^^^4,5^^^4,4^^^^4 

Solutions

Put your solutions here!

Personal tools