nyoj 366 D的小L
来源:互联网 发布:ubuntu防火墙关闭 编辑:程序博客网 时间:2024/05/17 06:56
D的小L(STL)
- 输入
- 第一行输入一个数N(0<N<10),表示有N组测试数据。后面的N行输入多组输入数据,每组输入数据都是一个整数x(0<x<10)
- 输出
- 按特定顺序输出所有组合。
特定顺序:每一个组合中的值从小到大排列,组合之间按字典序排列。 - 样例输入
223
- 样例输出
1221123132213231312321
#include<stdio.h>#include<algorithm>using namespace std;int main(){int T,a[10],i,n;scanf("%d",&T);while(T--){scanf("%d",&n);for(i=1;i<=n;i++) a[i-1]=i;do{for(i=0;i<n;i++) printf("%d",a[i]);printf("\n");}while(next_permutation(a,a+n));}return 0;}/*如果存在a之后的排列,就返回true。如果a是最后一个排列没有后继,返回false,每执行一次,a就变成它的后继#include<stdio.h>#include<algorithm>using namespace std;int main(){int a[3]={1,2,3};do{printf("%d %d %d\n",a[0],a[1],a[2]);}while(next_permutation(a,a+2)); return 0;}#include<stdio.h>#include<iostream>#include<string.h>#include<algorithm>using namespace std;int main(){char ch[205];int i;scanf("%s",ch);char *first=ch;char *last=ch+strlen(ch);do{for(i=0;ch[i]!='\0';i++) printf("%c",ch[i]);printf("\n");}while(next_permutation(first,last));return 0;}*/
0 0
- nyoj 366 D的小L
- NYOJ-366:D的小L
- NYOJ 366 D的小L
- nyoj-366-D的小L
- NYOJ,366,D的小L
- NYOJ----366D的小L
- nyoj 366 D的小L
- NYOJ D的小L 366
- NYoj 366 D的小L 【DFS】
- NYOJ---题目366D的小L
- NYOJ--366--D的小L
- NYOJ 366 D的小L
- NYOJ 366 D的小L
- nyoj-366 D的小L
- NYOJ 366 D的小L
- nyoj D的小L
- NYOJ-D的小L
- NYOJ-D的小L
- 三种保证URL地址可信的加密方式
- Android自定义控件——仿淘宝、网易、彩票等广告条、Banner的制作
- socket连接和http连接的区别
- Longest Palindromic Substring Java
- spinbox HTML源码
- nyoj 366 D的小L
- android中@+id 与@string的使用
- nand flash与nor flash区别
- 运行vs2012出现unknown hard error
- LeetCode Solutions : Path Sum I & II
- Ant 多渠道 多项目应用library 打包Android项目遇到问题总结
- chrome DevTool For Improving web app performance
- targetSdkVersion 相关了解
- NSURLProtocol Tutorial