## ECOO '17 R2 P3 - Lunch Time

View as PDF

Points: 12 (partial)
Time limit: 13.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Since beginning her university studies, Ava has been going to a nearby plaza for lunch. In order to maintain good eating habits throughout her university career, Ava has crafted a perfect dining strategy.

Ava began by eating at each of the restaurants (numbered through ) at the plaza and rating how much she enjoyed the food. Once she gathered all he ratings, she would only eat at the highest-rated restaurant. (If there is a tie, she eats at the lowest-numbered restaurant.) However, after a week of eating the same food, Ava realized she needs more variety in her diet. To fix this issue, she decided that eating at a restuarant would cause its rating to drop by a fixed amount, .

Armed with her dining strategy, Ava wonders where she will grab lunch on her last day of university, which is days away if she eats at exactly one restaurant per day.

#### Input Specification

The input will contain test cases. Each test case starts with three integers , . The next line contains positive integers , where represents the rating of the restaurant at the plaza. Restaurants are numbered starting from .

For the first four test cases in the file, . For the first seven cases, .

#### Output Specification

For each test case, your program should output one integer representing the restaurant Ava will eat at on the day.

#### Sample Input

2 5 4
20 17
5 4 7
1 2 4 8 16
4 8 100
3 22 20 14

#### Sample Output

2
5
3

Note: Only cases are shown in this sample.

Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org