Woburn Challenge 2018-19 Round 4 - Junior Division

Problem 1: A Fistful of Quarters

Billy, the king of video games, began his career off the back of a particular arcade game: Donkey Kong. Though he's masterfully played many other games since, there's nothing quite like popping in a few quarters and returning to the arcade classic.

Beginning a game of Donkey Kong requires the player to first insert at least D (1 ≤ D ≤ 5) dollars in change. Billy had previously already inserted Q (1 ≤ Q ≤ 20) quarters into his personal Donkey Kong arcade cabinet. He's now looking to insert zero or more additional quarters so that he can start playing.

What's the minimum number of additional quarters which Billy must insert such that the total amount of inserted change will come out to at least D dollars?

Input Format

The first line of input consists of a single integer, D.
The next line consists of a single integer, Q.

Output Format

Output a single integer, the number of additional quarters which Billy must insert.

Sample Input 1

2
3

Sample Output 1

5

Sample Input 2

1
20

Sample Output 2

0

Sample Explanation

In the first case, Billy has already inserted $0.75 (3 quarters), and must insert an additional $1.25 (5 quarters) to bring his total up to at least $2.00.

In the second case, Billy has already inserted at least $1.00 worth of quarters, so no more are required.

All Submissions
Best Solutions


Point Value: 5 (partial)
Time Limit: 2.00s
Memory Limit: 16M
Added: Mar 22, 2019
Author: SourSpinach

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

Comments (Search)

It's quiet in here...