#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll i,j,k,l,m,n,test;
cin>>test;
for(k=1;k<=test;k++)
{
string s="";
cin>>n>>m;
char c='A';
for(i=1;i<=n;i++)
{
s=s+c;
c++;
}
cout<<"Case "<<k<<":"<<endl;
cout<<s<<endl;
m--;
while(m--)
{
if(next_permutation(s.begin(),s.end()))
{
cout<<s<<endl;
}
else
break;
}
}
return 0;
}
using namespace std;
typedef long long ll;
int main()
{
ll i,j,k,l,m,n,test;
cin>>test;
for(k=1;k<=test;k++)
{
string s="";
cin>>n>>m;
char c='A';
for(i=1;i<=n;i++)
{
s=s+c;
c++;
}
cout<<"Case "<<k<<":"<<endl;
cout<<s<<endl;
m--;
while(m--)
{
if(next_permutation(s.begin(),s.end()))
{
cout<<s<<endl;
}
else
break;
}
}
return 0;
}
No comments:
Post a Comment