Advertisement
erfanul007

UVa729

Dec 5th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. vector<int>a,b;
  7. int i,k,j,n,m,t,p1,p2,p3,cnt;
  8. scanf("%d",&t);
  9. while(t--){
  10. scanf("%d %d",&m,&n);
  11. cnt=0;
  12. for(i=0;i<m-n;i++)
  13. a.push_back(cnt);
  14.  
  15. cnt=1;
  16.  
  17. for(i=0;i<n;i++)
  18. a.push_back(cnt);
  19.  
  20. do{
  21.  
  22. for(j=0;j<m;j++)
  23. cout<<a[j];
  24. cout<<endl;
  25. }
  26. while(next_permutation(a.begin(),a.end()));
  27. if(t)
  28. cout<<endl;
  29. a.clear();
  30. }
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement