Chef has infinite coins in denominations of rupees
and rupees.
Find the minimum number of coins Chef needs, to pay exactly
rupees. If it is impossible to pay rupees in denominations of rupees and only, print.
Input Format
- First line will contain
- .
Output Format
For each test case, print a single integer - the minimum number of coins Chef needs, to pay exactly
rupees. If it is impossible to pay rupees in denominations of rupees and only, print.
Constraints
Subtasks
- Subtask 1 (100 points): Original constraints.
Sample Input 1
3
50
15
8
Sample Output 1
5
2
-1
Explanation
Test Case
: Chef would require at least coins to pay rupees. All these coins would be of rupees.
Test Case
: Chef would require at least coins to pay rupees. Out of these, coin would be of rupees and coin would be of rupees.
Test Case
: Chef cannot pay exactly rupees in denominations of rupees and only.
No comments:
Post a Comment