Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- using namespace std;
- int a[1000], bio[1000], z[1000];
- int n;
- void rec( int r ) {
- if( r == n ) {
- for( int i = 0; i < n; ++i )
- printf( "%d ", z[i] );
- putchar( '\n' );
- return;
- }
- for( int x = 0; x < n; ++x )
- if( bio[x] == 0 ) {
- bio[x] = 1, z[r] = a[x];
- rec( r+1 );
- bio[x] = 0;
- }
- }
- int main( void ) {
- scanf( "%d", &n );
- for( int i = 0; i < n; ++i )
- scanf( "%d", a+i );
- rec( 0 );
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement