Advertisement
Saleh127

UVA 729

Jul 20th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 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. test
  10. {
  11. ll a,c,d,e,f,i,j,k,l;
  12. cin>>a>>c;
  13. string x="";
  14. for(i=0;i<a;i++)
  15. {
  16. if(i<a-c) x+='0';
  17. else x+='1';
  18. }
  19. for(j=0; ;j++)
  20. {
  21. cout<<x<<endl;
  22. if(next_permutation(x.begin(),x.end())==0)
  23. {
  24. break;
  25. }
  26. }
  27. if(t) cout<<endl;
  28. }
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement