#PU615. USACO 2016 February Contest, Bronze — Problem 1. Milk Pails
USACO 2016 February Contest, Bronze — Problem 1. Milk Pails
USACO 2016 February Contest, Bronze — Problem 1. Milk Pails
题目描述
Farmer John has received an order for exactly units of milk () that he needs to fill right away. Unfortunately, his fancy milking machine has just become broken, and all he has are three milk pails of integer sizes , , and (). All three pails are initially empty. Using these three pails, he can perform any number of the following two types of operations:
- He can fill the smallest pail (of size ) completely to the top with units of milk and pour it into the size- pail, as long as this will not cause the size- pail to overflow.
- He can fill the medium-sized pail (of size ) completely to the top with units of milk and pour it into the size- pail, as long as this will not cause the size- pail to overflow. Although FJ realizes he may not be able to completely fill the size- pail, please help him determine the maximum amount of milk he can possibly add to this pail.
输入格式
The first, and only line of input, contains , , and , separated by spaces.
输出格式
(见题面原文)
数据范围
(见题面原文)
样例
样例 1
17 25 77
76
In this example, FJ fills the pail of size 17 three times and the pail of size
25 once, accumulating a total of 76 units of milk.
Problem credits: Brian Dean