You have coins of values , and . What is the smallest number of coins needed form the sum exactly?
In this task, , i.e., can be very large. The algorithm should be efficient in all cases.
In a file morecoin.py
, implement a function count
that returns the smallest number of coins.
def count(x): # TODO if __name__ == "__main__": print(count(8)) # 2 print(count(12345)) # 2469 print(count(1337**9)) # 2730314408854633746890878156