#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
int i,j,k,T;
cin>>T;
while(T--)
{
int x,y;
string s1,s2;
cin>>x>>y;
for(i=1;i<=x;i++)
{
//s1.push_back('0'+i);//貌似也可
s1 += '0'+i;
}
s2=s1.substr(0,y);
cout<<s2<<endl;
while(next_permutation(s1.begin(),s1.end()))
{
if(s2!=s1.substr(0,y))
{
s2=s1.substr(0,y);
cout<<s2<<endl;
}
}
}
return 0;
}
擅长排列的小明 string + next_permutation 全排列
最新推荐文章于 2022-04-01 18:42:08 发布