Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- char s[30]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'},c[30];
- int t,l,n,k,i,j;
- cin>>t;
- for(l=1;l<=t;l++)
- {
- cin>>n>>k;
- for(i=0;i<=n;i++)
- c[i]=s[i];
- c[n]=0;
- cout<<"Case "<<l<<":"<<endl;
- do{
- puts(c);
- }while(--k && next_permutation(c,c+n));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement