# ================================ # Practice Problem 1 # ================================ # # You have a bucket that can hold X liters. # You can use this bucket many times. # # Find the largest amount of milk # that does not exceed M liters. # # Input # X M # # Output # The largest amount ≤ M # that can be made using X. # # Example # Input: # 3 14 # # Output: # 12 # # Hint: # Try multiplying X several times. # (X, 2X, 3X, ...) # ================================ # Practice Problem 2 # ================================ # # You have two bucket sizes: # X liters and Y liters. # # You can use each bucket many times. # # Find the largest amount of milk # that does not exceed M liters. # # Input # X Y M # # Output # Maximum possible amount ≤ M # # Example # Input: # 3 5 17 # # Output: # 17 # # Hint: # Try all combinations of: # i * X + j * Y # ================================ # Practice Problem 3 # ================================ # # Given X, Y, M, # print all possible amounts # that can be made using X and Y # without exceeding M. # # Input # X Y M # # Output # Print all possible values # in increasing order. # # Example # Input: # 4 7 20 # # Output: # 0 # 4 # 7 # 8 # 11 # 12 # 14 # 15 # 16 # 18 # 19 # 20 # # Hint: # Try every i and j. # Print i*X + j*Y if it is ≤ M. # ================================ # Practice Problem 4 # (Just Before BOJ 11999) # ================================ # # Given X, Y, M, # # Find the largest value # that can be made using: # # i * X + j * Y # # such that the result ≤ M. # # Input # X Y M # # Output # Maximum value ≤ M # # Example # Input: # 17 25 77 # # Output: # 76 # # Hint: # Try all combinations. # Keep track of the maximum value. # # This problem is almost the same # as BOJ 11999.
To embed this project on your website, copy the following code and paste it into your website's HTML: