The Hamming Distance Problem-uva
来源:互联网 发布:混合高斯模型算法原理 编辑:程序博客网 时间:2024/06/11 06:24
简单的字典排序,没什么难度,用c++的next_permutation()函数就可以了
#include<math.h>#include<iostream>#include<algorithm>#include<stdio.h>#define MAX_SIZE 1000 + 10using namespace std;int main(){ int N,cases,i,j,k; int m,n; char mat[MAX_SIZE]; scanf("%d",&N); for(cases=0;cases<N;cases++) { scanf("%d%d",&m,&n); for(i=0;i<m-n;i++) mat[i]='0'; for(;i<m;i++) mat[i]='1'; mat[i]='\0'; do { puts(mat); }while(next_permutation(mat,mat+m)); if(cases<N-1) printf("\n"); } return 0;}
0 0
- The Hamming Distance Problem-uva
- 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 排列组合
- UVa 729 - The Hamming Distance Problem
- UVa 729 - The Hamming Distance Problem
- UVA 729 - The Hamming Distance Problem
- UVa-729-The Hamming Distance Problem
- jQueryEasyUI .messager.alert
- 深入理解C++的动态绑定和静态绑定
- java.lang.Integer cannot be cast to java.lang.Long异常处理
- MySQL写入中文乱码之处理character_set_server编码
- ubuntu 10.04下如何以root身份登录
- The Hamming Distance Problem-uva
- Markdown Linux
- linux 命令快捷键
- 02字串2
- linux下安装apache
- ubuntu10.04 SSH 开启
- 关于UITabBar 显示图片的问题
- 岁月的沧桑,沧桑了谁的容颜?
- JSON资料整理