D's small l
Description
One day, TC went to the ACM's Xiao L to play with the Three Kingdoms, but this would be a little busy. I don't want to play with Kuang, but I'm afraid of being angry, at this time, Xiao l gave me a question to solve (Xiao L is very D), there is a number of N (0 <n <10), write a full arrangement of 1 to n, at this moment, I am a little confused. Can you help me solve the problem intelligently?
-
Input
-
Enter N (0 <n <10) in the first row, indicating that N groups of test data exist. The next n rows Input Multiple groups of input data, each group of input data is an integer x (0 <x <10)
-
Output
-
Output all combinations in a specific order. Specific order: Values in each combination are arranged in ascending order, and the combinations are arranged in lexicographically.
-
Sample Input
-
223
-
Sample output
-
1221123132213231312321
#include <iostream>#include <algorithm>using namespace std;int main(){ int n; cin>>n; while(n--) { int m; cin>>m; int arr[10]={1,2,3,4,5,6,7,8,9,10}; do { for(int i =0;i<m;i++) cout<<arr[i]; cout<<endl; }while(next_permutation(arr,arr+m)); } return 0;}
D's small l