Problem:

Change-Making Problem

You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.

Input

$n$

The integer $n$ is given in a line.

出力

Print the minimum number of coins you need in a line.

Constraints

  
$1 \le n \le 10^9$

Sample Input 1

100

Sample Output 1

4

Sample Input 2

54321

Sample Output 2

2175



Sample input:
100


Sample output:
4

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for x in (25, 10, 5, 1):
  ans += n // x
  n %= x
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a1 = n//25
a2 = (n - a1*25)//10
a3 = (n - a1*25 - a2*10)//5
a4 = n - a1*25 - a2*10 - a3*5
print(a1+a2+a3+a4)

Submission status: Accepted

Solution code:
n = input()

n_25 = int(n) // 25
tmp = int(n) % 25
n_10 = tmp // 10
tmp %= 10
n_5 = tmp // 5
tmp %= 5
n_1 = tmp


print(n_25 + n_10 + n_5 + n_1)

Submission status: Accepted

Solution code:
# https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/15/ALDS1_15_A


n = int(input())

cnt = 0
coin = (25, 10, 5, 1)
for c in coin:
    cnt += n // c
    n -= c * (n // c)

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
c = 0
c += n//25
n %= 25
c += n//10
n %= 10
c += n//5
c += n%5
print(c)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
cnt += n//25
n = n % 25
cnt += n//10
n = n % 10
cnt += n//5
n = n % 5
cnt+=n
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
coins = [25, 10, 5, 1]
ans = 0

for coin in coins:
    ans += int(n/coin)
    n = n%coin

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

cnt = 0
for m in reversed([1, 5, 10, 25]):
    cnt += n // m
    n %= m

print(cnt)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    cnt = 0
    for i in [25, 10, 5, 1]:
        cnt += n // i
        n = n % i
    print(cnt)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

cnt = n // 25
n = n % 25
while n >= 10:
    cnt += 1
    n -= 10
while n >= 5:
    cnt += 1
    n -= 5
cnt += n

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
coin = [25,10,5,1]
sum_s = 0
for i in coin:
    sent = n // i
    n %= i
    sum_s += sent
print(sum_s)

Submission status: Accepted

Solution code:
import sys, collections
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    n = I()

    ans = 0
    for i in (25, 10, 5, 1):
        ans += n // i
        n %= i

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
#標準入力と変数の初期化
num = int(input())
coin = 0

#25セントを使える枚数を調べ合計金額から減らす
coin += num // 25
num -= num // 25 * 25

#10セントを使える枚数を調べ合計金額を減らす
coin += num // 10
num -= num // 10 * 10

#5セントを使える枚数を調べ合計金額を減らす
coin += num // 5
num -= num // 5 * 5

#1セントの枚数を足し出力する
print(coin + num)

Submission status: Accepted

Solution code:
m = int(input())    #money
c =0    #count coin
tc = 0   #temp coin
if m>=25:
    c = m//25
    m = m-(25*c)

if  m>=10:
    tc = m//10
    m = m-(10*tc)
    c += tc

if m>=5:
    tc = m//5
    m = m-(5*tc)
    c += tc

if m>=0:
    tc = m//1
    m = m-(1*tc)
    c += tc
    
print(c)

Submission status: Accepted

Solution code:
def main():
    n = int(input())

    C = [25,10,5,1]
    ans = 0
    for i in range(4):
        ans += n // C[i]
        n %= C[i]

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def num_coins(cents):
    coins = [25, 10, 5, 1]
    count = 0
    for coin in coins:
        while cents >= coin:
            cents = cents - coin
            count = count + 1

    return count

print(num_coins(int(input())))

Submission status: Accepted

Solution code:
def Main():
    n = int(input())

    count = 0
    cents = [25, 10, 5, 1]

    for c in cents:
        q, mod = divmod(n, c)
        count += q
        n -= c*q

    print(count)

Main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    coins = [25,10,5,1]
    res = 0
    for c in coins:
        res+=n//c
        n = n%c
    print (res)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
coins = [25, 10, 5, 1]
n = int(input())
ans = 0
for i in coins:
    ans += n//i
    n %= i
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
ans+=n//25
n%=25
ans+=n//10
n%=10
ans+=n//5
n%=5
ans+=n
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
ans += n//25
n = n%25
ans += n//10
n = n%10
ans += n//5
n = n%5
ans += n
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
a=[25,10,5,1]
for i in a:
    if n<=0:
        break
    d=n//i
    ans+=d
    n-=i*d
    #print(n,ans)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

C = [ 25, 10, 5, 1]
c = 0
for i in range(len(C)):
    c += n//C[i]
    n = n % C[i]

print(c)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0

for a in [25, 10, 5, 1]:
    ans += n // a
    n %= a

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
c25=n//25
n%=25
c10=n//10
n%=10
c5=n//5
n%=5
ans = c25 + c10 + c5 + n
print(ans)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    input_value = int(input())
    twenty_five_n = input_value // 25
    input_value = input_value - 25 * twenty_five_n
    ten_n = input_value // 10
    input_value = input_value - 10 * ten_n
    five_n = input_value // 5
    input_value = input_value - 5 * five_n

    print(f"{twenty_five_n + ten_n + five_n + input_value}")

Submission status: Accepted

Solution code:
n = int(raw_input())
coins = [25,10,5,1]
ans = 0
for coin in coins:
    t = int(n / coin)
    n -= t * coin
    ans += t
print ans

Submission status: Accepted

Solution code:
n = int(input())
c2=0
c3=0
c4=0

c1 = int(n/25)
n = n - 25*c1
if n > 0:
    c2 = int(n/10)
    n = n - 10*c2
    
if n > 0:
    c3 = int(n/5)
    n = n - 5*c3
    
if n > 0:
    c4 = n

print(c1+c2+c3+c4)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Greedy algorithms - Change Making
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_15_A&lang=jp

"""
import sys


def solve(n):
    ans = 0
    for c in (25, 10, 5, 1):
        q, r = divmod(n, c)
        ans += q
        n = r
    return ans


def main(args):
    n = int(input())
    ans = solve(n)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
n=int(input())
cnt=n
ans=0
cnt25=divmod(cnt,25)
ans+=cnt25[0]
cnt=cnt25[1]
cnt10=divmod(cnt,10)
ans+=cnt10[0]
cnt=cnt10[1]
cnt5=divmod(cnt,5)
ans+=cnt5[0]
cnt=cnt5[1]
cnt1=divmod(cnt,1)
ans+=cnt1[0]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
n_calc = n

C = [1, 5, 10, 25]

cnt = 0

for c in C[::-1]:
    q, n_calc = divmod(n_calc, c)
    cnt += q

    if int(n_calc) == 0:
        break


print(cnt)

Submission status: Accepted

Solution code:
n= int(input())
ans = 0
a = n % 25
b = a % 10
c = b % 5
ans += n//25 + a//10 + b//5 + c
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
quarter=n//25
n=n%25
ten=n//10
n=n%10
five=n//5
n=n%5
print(quarter+ten+five+n)

Submission status: Accepted

Solution code:
n = int(input())
many = [25, 10, 5, 1]
cnt = 0
for i in many:
    cnt += n//i
    n = n%i
print(cnt)

Submission status: Accepted

Solution code:
import sys

n = int(sys.stdin.readline())

k = 0
for c in [25, 10, 5]:
    k += n // c
    n %= c

print(k+n)

Submission status: Accepted

Solution code:
#  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_15_A&lang=jp
#  Greedy alogithms : python3
#  2019.2.3 yonezawa

import sys
input = sys.stdin.readline
#import cProfile

def main():
    s = int(input())
    cv = [25,10,5,1]
    n = 0
    for i in cv:
        n += s // i
        s = s % i
    print (n)

if __name__ == '__main__':
    main()
    #pr = cProfile.Profile()
    #pr.runcall(main)
    #pr.print_stats()

Submission status: Accepted

Solution code:
C = (25, 10, 5, 1)

n = int(input())

ans = 0

for c in C:
    ans += n // c
    n %= c

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans  = N // 25; N %= 25
ans += N // 10; N %= 10
ans += N // 5; N %= 5
ans += N
print(ans)

Submission status: Accepted

Solution code:
coins = [25,10,5,1]

n = int(input())

ans = 0

for coin in coins:
	if n == 0:
		break
	else:
		ans += int(n/coin)
		n = n % coin

print(ans)

Submission status: Accepted

Solution code:
target = int(input())
coins = [25, 10, 5, 1]
ans = 0
for c in coins:
    ans += target // c
    target %= c
print(ans)

Submission status: Accepted

Solution code:
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

COIN = [25,10,5,1]

N = int(input())

ans = 0

for i in range(len(COIN)):
    ans += N//COIN[i]
    N %= COIN[i]

print("%d"%(ans))