我就不信下次还会因为if(t)WA@、@
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int main() {
int t;
int str[25];
cin >> t;
while (t--) {
int n, h;
cin >> n >> h;
int i;
for (i = 0; i < n; i++) {
if (i < n - h)
str[i] = 0;
else
str[i] = 1;
}
do {
for (i = 0; i < n; i++)
cout << str[i];
cout << endl;
}
while (next_permutation(str, str + n));
if (t)
cout << endl;
}
return 0;
}