### 2010 Canadian Computing Competition, Stage 1

## Problem J2: Up and Down

Nikky and Byron are playing a silly game in gym class.
Nikky is told by his teacher to walk forward `a` steps and then walk backward `b`
steps, after which he repeats `a` forward, `b` backward, etc. Likewise, Byron is told to
walk forward `c` steps and then walk backward `d` steps, after which he repeats `c` forward, `d` backward, *etc*. You may assume that `a` ≥ `b` and `c` ≥ `d`.

Byron and Nikky have the same length of step, and they are required to take their steps simultaneously (that is, Nikky and Byron will both step forward on their first steps at the same time, and this will continue for each step).

Nikky and Byron start walking from one end of a soccer field. After `s` steps,
the gym teacher will blow the whistle. Your task is to figure out who has moved the farthest away
from the starting position when the whistle is blown.

### Input Format

The input will be the 5 integers a, b, c, d (1 ≤ `a`, `b`, `c`, `d` ≤ 100), and `s` (1 ≤ `s` ≤ 10000), each on a separate line.

### Output Format

The output of your program will be one of three possibilities: `Nikky`

if Nikky is farther ahead
after `s` steps are taken; `Byron`

if Byron is farther ahead after `s` steps are taken; `Tied`

if Byron and
Nikky are at the same distance from their starting position after `s` steps are taken.

### Sample Input

4 2 5 3 12

### Sample Output

Byron

### Explanation

Notice that after 12 steps, Nikky has moved 4 − 2 + 4 − 2 steps, for a total of 4 steps from the starting position, whereas Byron has moved 5 − 3 + 4 steps, for a total of 6 steps from the starting position. Thus, Byron is ahead.

All Submissions

Best Solutions

**Point Value:** 5

**Time Limit:** 2.00s

**Memory Limit:** 16M

**Added:** Feb 23, 2010

**Languages Allowed:**

C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

## Comments (Search)

tailaiwangon Mar 22, 2017 - 12:46:28 am UTC Suggestionjargonon Mar 22, 2017 - 2:10:26 am UTC Re: SuggestionAceon Jul 15, 2011 - 3:45:09 pm UTC Confusedjargonon Jul 15, 2011 - 4:39:27 pm UTC Elaboratebobbyg212009on Jan 31, 2011 - 3:13:23 am UTC WAT???jargonon Jan 31, 2011 - 3:31:13 am UTC Re: WAT???You'll find the problem set here.

ilovepion Feb 01, 2011 - 12:48:08 am UTC Re: Re: WAT???jargonon Feb 04, 2011 - 6:34:19 pm UTC Re: Re: WAT???bbi5291on Feb 04, 2011 - 8:28:34 pm UTC Re: Re: WAT???