#C2264. Minimum Coin Change
Minimum Coin Change
Minimum Coin Change
You are given a non-negative integer \( n \) which represents an amount. Your task is to find the minimum number of coins required to sum up to \( n \) using coins of denominations \(3\), \(7\), and \(10\). If it is impossible to form the amount \( n \) using any combination of these coins, output \(-1\).
Example 1: For \( n = 24 \), the minimum number of coins is 3 (e.g., 7 + 7 + 10 = 24).
Example 2: For \( n = 11 \), it is not possible to form the amount, so output is -1.
Example 3: For \( n = 30 \), one optimal solution is 10 + 10 + 10, so output is 3.
inputFormat
The input consists of a single line containing one integer \( n \) (\(0 \leq n \leq 10^5\)). This value represents the amount for which you need to find the minimum number of coins.
outputFormat
Output a single integer representing the minimum number of coins required to form the amount \( n \). If it is not possible to form the amount, output \(-1\).
## sample24
3