Stairs issue

xiaoxiao2021-03-05  28

#include

#define n 5

Int index;

INT Que [n];

Void print ()

{

For (INT i = 0; i

Printf ("% D", QUE [I]);

Printf ("/ n");

}

Void Step (INT N)

{

IF (n == 0)

{

PRINT ();

Return;

}

QUE [INDEX ] = 1;

Step (N-1);

--index;

IF (n> 1)

{

QUE [INDEX ] = 2;

Step (n-2);

--index;

}

IF (n> 2)

{

QUE [INDEX ] = 3;

Step (n-3);

--index;

}

}

void main ()

{

Step (n);

}

转载请注明原文地址:https://www.9cbs.com/read-33903.html

New Post(0)