Desordre X79253


Statement
 

pdf   zip

Donat un natural nn, escriu un programa que mostri pel canal de sortida la següent seqüència (de mida nn):

1,n,2,n1,3,n2,4,n3,1, n, 2, n-1, 3, n-2, 4, n-3, \dots

Entrada

L’entrada consisteix en un natural n>0n > 0.

Sortida

Escriu la següent seqüència.

1,n,2,n1,3,n2,4,n3,1, n, 2, n-1, 3, n-2, 4, n-3, \dots

tenint en compte el valor de nn.

Public test cases
  • Input

    4
    

    Output

    1
    4
    2
    3
    
  • Input

    5
    

    Output

    1
    5
    2
    4
    3
    
  • Information
    Author
    Jaume Baixeries
    Language
    Catalan
    Official solutions
    Python
    User solutions
    Python