uva 729 - The Hamming Distance Problem
2013-05-21 21:15
363 查看
注意一的个数是第一个数减第二个数。
#include<iostream> #include<cstring> #include<algorithm> using namespace std; int main() { int n; char str[1000]; cin>>n; while(n--) { memset(str,0,sizeof(str)); int len,zero_num; cin>>len>>zero_num; for(int i=0; i<len-zero_num; i++) str[i]='0'; for(int i=len-zero_num; i<len; i++) str[i]='1'; str[len]='\0'; cout<<str<<endl; while(next_permutation(str,str+len)) cout<<str<<endl; if(n)cout<<endl; } return 0; }
相关文章推荐
- uva 729 The Hamming Distance Problem
- UVa 729 The Hamming Distance Problem
- UVa729 - The Hamming Distance Problem(全排列)
- UVa729 The Hamming Distance Problem
- uva729 - The Hamming Distance Problem(Hamming距离问题)
- uva - 729 - The Hamming Distance Problem
- UVa 729 - The Hamming Distance Problem
- UVa 729 - The Hamming Distance Problem
- UVA 729 The Hamming Distance Problem
- UVa 729 - The Hamming Distance Problem
- UVa 729 - The Hamming Distance Problem (暗藏杀机的大水题!!)
- UVA 729 - The Hamming Distance Problem
- UVa 729 - The Hamming Distance Problem
- UVA 729 The Hamming Distance Problem
- uva 729 - The Hamming Distance Problem(全排列)
- uva 729 The Hamming Distance Problem
- UVA - 729 The Hamming Distance Problem
- UVA 729 - The Hamming Distance Problem
- uva729 The Hamming Distance Problem
- UVa 729: The Hamming Distance Problem