Describe
One day TC's Marina to find ACM small L play Three Kingdoms kill, but this will be small l busy mile, do not want to play with the marina, but also afraid of the marina, the small l to marina out a topic want to baffle marina (small l very D bar), there is a number n (0<n<10), write 1 to N of the whole arrangement, then marina a little embarrassed,,, Smart can you help Marina to the rescue?
-
-
Input
-
-
the first line enters a number n (0<n<10), which indicates that there are n sets of test data. The following n lines enter multiple sets of input data, each set of input data is an integer x (0<x<10)
Output
output all combinations in a specific order.
Specific order: The values in each combination are arranged from small to large, and the combinations are arranged in dictionary order.
Sample input
223
Sample output
1221123132213231312321
Source
Original
#include <iostream> #include <stdio.h> #include <algorithm> #include <string.h>using namespace Std;int Main () {int T,n,i;cin>>t;while (t--) {int a[20]={0};cin>>n;for (i=0;i<n;i++) a[i]=i+1;do{for (i= 0;i<n;i++) Cout<<a[i];cout<<endl;} while (Next_permutation (A,a+n));} return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
D's Small L