uva729(简单题) - 全排列
2015-12-13 15:14
309 查看
@、@我就不信下次还会因为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;elsestr[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;}
相关文章推荐
- 网卡Team
- 7.ROBOTS.TXT的SEO优化
- git 应用
- 正则表达式所有元字符及其使用方法一览表
- 汉高澳大利亚matrix矩阵计算器
- 深入学习Android中的Intent
- android shape渐变详解
- 源码分享-图片马赛克生成程序
- 一些常见的易于混淆的概念
- 【转】C# 接口的隐式与显示实现
- CSS之transition, transform, tanslate,animation
- c++构造函数和赋值操作符
- PAT PAT 1023. Have Fun with Numbers (20)
- 2015年蓝桥杯C/C++ B组题目题解
- Configure One-to-One(配置一对一关系)【Code-First系列】
- 共享锁与排它锁
- 10个迷惑新手的Cocoa&Objective-c开发问题
- geos库编译关键步骤
- QT图表绘制
- uva10098(简单题)-全排列