402178: GYM100687 D Forming Teams (B)
Memory Limit:64 MB
Time Limit:0 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
D. Forming Teams (B)time limit per test0.5 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard output
Mr. Ahmad found that in some cases, it is impossible to satisfy everyone. Therefore, some individuals might be assigned to teams.
There are K PCs available at the IT labs, which may be prepared for 1, 2 or 3 students. Find the minimum possible number of unsatisfied students.
InputThe input contains 3 space-separated integers: N M K, where:
N is the number of students who don’t mind to participate individually or in a team of 2 or 3 members.
M is the number of students who chose to participate individually.
K is the number of available PCs in the IT Labs.
All integers are between 0 and 1,000,000,000 (inclusive).
OutputIf K PCs are not enough to allow everyone to participate, print -1, otherwise print the minimum number of unsatisfied students.
ExamplesInput4 8 8Output
2Input
8 5 3Output
-1Input
6 3 6Output
0