UVa 729 - The Hamming Distance Problem

来源:互联网 发布:爱普生打印机清零软件 编辑:程序博客网 时间:2024/05/16 09:57

传送门UVa 729 - The Hamming Distance Problem


水啊。。


#include <cstdio>#include <iostream>#include <algorithm>#include <string>using namespace std;int main(){//freopen("input.txt", "r", stdin);int n, a, b;scanf("%d", &n);while (n--){scanf("%d%d", &a, &b);string str1(a - b, '0');string str2(b, '1');str1 += str2;cout << str1 << endl;while (next_permutation(str1.begin(), str1.end()))cout << str1 << endl;if (n)cout << endl;}return 0;}





0 0
原创粉丝点击