LCC '22 Contest 1 J1 - Costume Contest

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

The costume contest has concluded and the results are in!

There are three finalists whose costumes are given scores A, B, and C. The winners are the finalists with the highest score (there may be multiple).

Max is finalist 1 and thinks his costume is awesome. Shane thinks otherwise, and wants to make sure he does not win. Thus, Shane plans to hack the database and adjust Max's score so that he is not a winner.

In order to minimize suspicion, Shane will subtract the minimum value from Max's score that ensures he is not a winner.

Constraints

1 \le A, B, C \le 30

Input Specification

There are three lines of input.

The first line will contain the integer A (Max's score), the second will contain the integer B, and the third and last line will contain the integer C.

Output Specification

Output an integer, the minimum value that needs to be subtracted from Max's score such that he is not a winner.

Sample Input 1

26
20
21

Sample Output 1

6

Explanation for Sample Output 1

Max's score is 26. If we subtract 6 from his score, it becomes 20 which is less than the now highest score of 21. Thus, 6 is the minimum value that needs to be subtracted.

Sample Input 2

29
30
30

Sample Output 2

0

Sample Input 3

2
1
1

Sample Output 3

2

Comments

There are no comments at the moment.