UVaOJ 10098 - Generating Fast
来源:互联网 发布:淘宝上如何卖游戏币 编辑:程序博客网 时间:2024/05/09 18:20
——by A Code Rabbit
Description
输入一个序列,要求输出这个序列所属的所有全排列。
Types
Brute Force :: Elementary Skills
Analysis
用 perv_permutation( )把序列变成所有全排列最小的那个,然后再用next_permutation( )边变大边输出。
要注意两个函数会发生“回绕”。Solution
// UVaOJ 10098// Generating Fast// by A Code Rabbit#include <algorithm>#include <cstdio>#include <cstring>using namespace std;const int LIMITS = 12;int n;char str[LIMITS];int main() { scanf("%d", &n); getchar(); while (n--) { gets(str); int len = strlen(str); while (prev_permutation(str, str + len)) { } next_permutation(str, str + len); do { puts(str); } while (next_permutation(str, str + len)); printf("\n"); } return 0;}
下载PDF
参考资料:无
- UVaOJ 10098 - Generating Fast
- UVAOJ 10098 Generating Fast
- UvaOJ 10098 Generating Fast, Sorted Permutation
- UVa 10098 Generating Fast
- 10098--Generating Fast
- uva 10098 - Generating Fast
- 10098 - Generating Fast
- UVa 10098 Generating Fast
- uva 10098 - Generating Fast
- UVa 10098 - Generating Fast
- 10098 - Generating Fast
- UVa 10098 Generating Fast
- Uva 10098 - Generating Fast
- UVA 10098 - Generating Fast
- UVa 10098 - Generating Fast
- uva 10098 - Generating Fast
- UVa 10098: Generating Fast
- uva 10098 Generating Fast
- Direct Reports and loading the component
- 环境变量(environment variables,简称ENV)与相关指令
- JS 字符串操作函数
- 程序员看世界之京东加班被离职(3)2012-7-18
- ubuntu 安装 jdk 1.5
- UVaOJ 10098 - Generating Fast
- Using partition by to write alternative SQL to get effdt and effseq items
- Linux-网桥原理分析[一]
- 浏览器是怎样工作的(一):基础知识
- 二分法:解方程
- 浏览器是怎样工作的:渲染引擎,HTML解析(连载二)
- hdu 1338 #greedy
- Create Google Maps directions in PeopleSoft using Related Content
- 各种排序算法