summaryrefslogtreecommitdiff
path: root/AlgoDesignAndTechniqueEdxPython/sources/changingmoney.py
blob: 5369b9ebd03fa761e5867d7956a866adb923fb94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Uses python3
def getNumOfCoins(m):
    # coins with denominations of 1, 5, and 10
    coinCount = 0
    remainder = 0
    if m / 10 == 0 & m % 10 == 0:
        return m / 10
    coinCount = coinCount + int(m / 10)
    remainder = m % 10
    if remainder >= 5:
        return coinCount + 1 + remainder - 5
    else:
        return coinCount + remainder


m = int(input())
print(getNumOfCoins(m))