D的小L
来源:互联网 发布:数据库基础与应用 编辑:程序博客网 时间:2024/04/28 16:02
D的小L
时间限制:4000 ms | 内存限制:65535 KB
难度:2
- 描述
- 一天TC的匡匡找ACM的小L玩三国杀,但是这会小L忙着哩,不想和匡匡玩但又怕匡匡生气,这时小L给匡匡出了个题目想难倒匡匡(小L很D吧),有一个数n(0<n<10),写出1到n的全排列,这时匡匡有点囧了,,,聪明的你能帮匡匡解围吗?
- 输入
- 第一行输入一个数N(0<N<10),表示有N组测试数据。后面的N行输入多组输入数据,每组输入数据都是一个整数x(0<x<10)
- 输出
- 按特定顺序输出所有组合。
特定顺序:每一个组合中的值从小到大排列,组合之间按字典序排列。 - 样例输入
223
- 样例输出
1221123132213231312321
my answer:
#include<iostream>#include<algorithm>#include<string>#include<cstring>using namespace std;int main(){int n,m;cin>>n;char buf[10];while(n--){cin>>m;for(int i=0;i!=m;i++) buf[i]=char('1'+i); buf[m]='\0';do{cout<<buf<<endl; }while(next_permutation(buf,buf+m)); //注意,这里的界限条件返回的是迭代器而不是int型的数字。}return 0;}
0 0
- D的小L
- d的小l
- D的小L
- D的小L
- D的小L
- D的小L
- D的小L
- D的小L
- D的小L
- D的小L
- D的小 L
- D的小L
- D的小L
- D的小L
- D的小L
- D的小L
- D的小L
- D的小L
- sql 查询非时间类型数据
- [算法第一轮复习] kruskal求最小生成树算法
- There is no result type defined for type 'json' mapped with name 'success'.
- 使用java发送https的请求
- Simplify Path -- leetcode
- D的小L
- Understanding /etc/shadow file
- timed out waiting for device to boot,unable to boot the iOS Simulator
- 海量数据处理
- zoj 3609 Modular Inverse(求逆元)
- 让dialog消失和显示的方法
- WCF权限-搭框架有感(下)
- 证明调和级数发散
- 【FOJ 1350】 Very Simple Problem