TORONTO KIDS COMPUTER CLUB | Aurora Monday 18:30 Python Homework 20.09.28.
18370
post-template-default,single,single-post,postid-18370,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Aurora Monday 18:30 Python Homework 20.09.28.

01 Oct Aurora Monday 18:30 Python Homework 20.09.28.

Question:
Anna and Jack are playing a game.

Each player starts with 100 points. The game uses standard six-sided dice and is played in rounds. During one round, each player rolls one die. The player with the lower roll loses the number of points shown on the higher die. If both players roll the same number, no points are lost by either player.

Write a program to determine the final scores.

Input Specification
The first line of input contains the integer n (1 ≤ n ≤ 15), which is the number of rounds that will be played. On each of the next n lines, will be two integers: the roll of Anna for that round, followed by a space, followed by the roll of Jack for that round. Each roll will be an integer between 1 and 6 (inclusive).

Output Specification
The output will consist of two lines. On the first line, output the number of points that Anna has after all rounds have been played. On the second line, output the number of points that Jack has after all rounds have been played.

Sample Input
4
5 6
6 6
4 3
5 2

Output for Sample Input
94
91

Explanation of Output for Sample Input
After the first round, Jack wins, so Anna loses 6 points. After the second round, there is a tie and no points are lost. After the third round, Anna wins, so Jack loses 4 points. After the fourth round, Anna wins, so Jack loses 5 points. In total, Anna has lost 6 points and Jack has lost 9 points.

No Comments

Sorry, the comment form is closed at this time.