#K9991. Dice Game Scoring
Dice Game Scoring
Dice Game Scoring
In this problem, Jane and John play a dice game over T turns. Each turn, both players roll two dice. Their scores for the turn are calculated as follows:
- If both dice show the same number, the player's score for that turn is the sum of the dice plus an additional bonus equal to twice the number on one die. Formally, if the dice values are \(d\) and \(d\), the score is \(d + d + 2\times d = 4d\).
- If the dice show different numbers, the score for that turn is simply the sum of the two numbers.
After all turns, the player with the higher total score wins. If both have the same total, the game ends in a draw. Your task is to compute and output the final scores followed by the game result in the format:
Jane: [Jane's Score] John: [John's Score] [Result]
The result is "Jane wins" if Jane's score is higher, "John wins" if John's score is higher, and "Draw" if their scores are equal.
inputFormat
The input is read from standard input and has the following format:
T j1 j2 h1 h2 j1 j2 h1 h2 ... (T lines in total)
Here, T is an integer representing the number of turns. Each of the next T lines contains four integers: the first two are Jane's dice values and the last two are John's dice values.
outputFormat
The output should be written to standard output. It should be a single line in the following format:
Jane: [Jane's Score] John: [John's Score] [Result]
Replace [Jane's Score] and [John's Score] with the computed scores and [Result] with "Jane wins", "John wins", or "Draw" accordingly.
## sample3
1 2 3 3
4 4 2 5
6 6 5 5
Jane: 43 John: 39 Jane wins