您的位置:首页 > 其它

UVa 729 - The Hamming Distance Problem

2013-05-14 09:34 316 查看
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAX = 16+4;
int A[MAX];

int main ()
{
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif
int T;
scanf("%d", &T);
while(T--) {
int N, H;
scanf("%d%d", &N, &H);
int i;
for(i=0; i<N-H; i++) A[i] = 0;
for(;i<N; i++) A[i] = 1;
do{
for(i=0; i<N; i++) printf("%d",A[i]);
printf("\n");
}while(next_permutation(A, A+N));
if(T>0) printf("\n");
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: