Minimal change? P29216


Statement
 

pdf   zip

html

Write a program that reads a sequence of combinations of euro coins, and for each one determines if it the minimum or is not.

Input

Input consists of a sequence of lines. Each line starts with a natural number n, followed by n numbers. Each number is 1, 2, 5, 10, 20, 50, 100 or 200.

Output

For each input line, print if is the minimal change or is not, according to the instance. We say that a change is minimal if there is not any combination with less coins that adds the same.

Public test cases
  • Input

    4   20 5 200 1
    2   5 5
    

    Output

    Canvi 1: es minim
    Canvi 2: no es minim
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++