Zeros and ones P20867


Statement
 

pdf   zip

thehtml

Write a program that prints all the combinations of z zeros and o ones such that z + u = n, for a given n.

Input

The input consists of a natural 0 < n < 11.

Output

Your program must print all the combinations in lexicographical order (look the instance), one per line, the characters separated by spaces.

Author: Salvador Roura

Public test cases
  • Input

    3
    

    Output

    0 0 0
    0 0 1
    0 1 0
    0 1 1
    1 0 0
    1 0 1
    1 1 0
    1 1 1
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Spanish
    Other languages
    Spanish
    Official solutions
    C++
    User solutions
    C++