Saleh127

LO 1023.cpp

Jun 30th, 2020
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. int main()
  7. {
  8. fellow_junior
  9. string x="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  10. ll c,d,e,i,j,k,l;
  11. cin>>c;
  12. for(i=1;i<=c;i++)
  13. {
  14. cin>>d>>e;
  15. cout<<"Case "<<i<<":"<<endl;
  16. string a="";
  17. for(j=0;j<d;j++)
  18. {
  19. a+=x[j];
  20. }
  21. for(j=0;j<e;j++)
  22. {
  23. cout<<a<<endl;
  24. if(next_permutation(a.begin(),a.end())==0)
  25. {
  26. break;
  27. }
  28. }
  29. }
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment