Saleh127

LO 1023

Sep 9th, 2020
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; while(t--)
  5. ll used[100]= {0};
  6. char ss[1000];
  7. ll a,c,d,e=0,f;
  8. void zxcxc(ll ind)
  9. {
  10.  
  11. if(ind==a)
  12. {
  13. ss[ind]='\0';
  14. cout<<ss<<endl;
  15. e++;
  16. return;
  17. }
  18. for(ll i=0; i<a; i++)
  19. {
  20. if(e==c) return ;
  21. if(used[i]==0)
  22. {
  23. used[i]=1;
  24. ss[ind]=(65+i);
  25. zxcxc(ind+1);
  26. used[i]=0;
  27. }
  28. }
  29. return;
  30. }
  31.  
  32. int main()
  33. {
  34.  
  35. ll x,l;
  36. cin>>x;
  37. for(l=1; l<=x; l++)
  38. {
  39. cin>>a>>c;
  40. e=0;
  41. printf("Case %lld:\n",l);
  42. zxcxc(0);
  43. e=0;
  44. }
  45. return 0;
  46. }
  47.  
  48.  
Advertisement
Add Comment
Please, Sign In to add comment