Every change

Write a program such that, for every given natural number nn, prints all the different ways to obtain nn cents with the euro system of coins (1 cent, 2 cents, 5 cents, 10 cents, 20 cents, and 50 cents).

Input

Input consists of a sequence of natural numbers 1n501 \le n \le 50.

Output

For every nn, print all the ways to obtain nn cents, each one in a different line. The numbers of each line must appear in nonincreasing order. The solutions for every nn must appear in reverse lexicographical order. Print an empty line after the output for each case.

Observation

A simple backtracking program that computes the result for every given nn (even if repeated) is fast enough for this problem.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:37:58.407Z

© Jutge.org, 2006–2026.
https://jutge.org