From one to en (1) P69348


Statement
 

pdf   zip

thehtml

Write program that prints all the permutations of { 1, …, n } for a given n.

Input

Input consists of a natural number n > 0.

Output

Print all the permutations of { 1, …, n } in lexicographical order.

Public test cases
  • Input

    3
    

    Output

    (1,2,3)
    (1,3,2)
    (2,1,3)
    (2,3,1)
    (3,1,2)
    (3,2,1)
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Python
    User solutions
    C++ Python