Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- char str[20];
- int main()
- {
- int test,i,n,h;
- scanf("%d",&test);
- while(test--)
- {
- scanf("%d%d",&n,&h);
- for(i=0;i<n-h;i++)
- {
- str[i] = '0';
- }
- for(i=n-h;i<n;i++)
- {
- str[i] = '1';
- }
- str[n] = '\0';
- printf("%s\n",str);
- while(next_permutation(str,str+n))
- {
- printf("%s\n",str);
- }
- if(test)
- {
- puts("");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement