Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define test int t; cin>>t; while(t--)
- ll used[100]= {0};
- char ss[1000];
- ll a,c,d,e=0,f;
- void zxcxc(ll ind)
- {
- if(ind==a)
- {
- ss[ind]='\0';
- cout<<ss<<endl;
- e++;
- return;
- }
- for(ll i=0; i<a; i++)
- {
- if(e==c) return ;
- if(used[i]==0)
- {
- used[i]=1;
- ss[ind]=(65+i);
- zxcxc(ind+1);
- used[i]=0;
- }
- }
- return;
- }
- int main()
- {
- ll x,l;
- cin>>x;
- for(l=1; l<=x; l++)
- {
- cin>>a>>c;
- e=0;
- printf("Case %lld:\n",l);
- zxcxc(0);
- e=0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment