POJ 1256 全排列函数
来源:互联网 发布:朴素贝叶斯算法例子 编辑:程序博客网 时间:2024/06/06 03:19
题目要求是按照给出的字母顺序进行全排列并非是ASCII的顺序 可以用STL的全排列函数 这道题可以对全排列函数有更深一步的理解 那就是构造cmp函数等同sort一样 给出明确的大小顺序就可以比较
#include <iostream>#include<cstdio>#include<algorithm>#include<cstring>using namespace std;int cmp(char a,char b){ if(a>='a'&&b>='a') return a<b; if(a<='Z'&&b<='Z') return a<b; if(a>='a'&&b<='Z') return a<b+32; if(a<='Z'&&b>='a') return a+32<=b;}int main(){ char c[15];int len,t; scanf("%d",&t); while(t--) { scanf("%s",c); len=strlen(c); sort(c,c+len,cmp); do puts(c); while(next_permutation(c,c+len,cmp)); } return 0;}
- POJ 1256 全排列函数
- POJ 1256 全排列
- POJ 1833 1146 1256 全排列系列 next_permutation函数
- poj-1256 Anagram 全排列
- POJ 1256 Anagram(next_permutation全排列)
- poj-1146-全排列
- 【poj】3187全排列
- POJ 2718 Smallest Difference(DFS+全排列函数)
- 全排列函数
- 全排列 函数模板
- c++全排列函数
- 排序函数-全排列
- c++全排列函数
- Perm--全排列函数
- 全排列 next_permutation()函数
- 全排列函数
- POJ 1833:排列 [#使用STL的next_permutation函数生成全排列#]
- POJ 1833 排列(全排列 STL)
- Asp.net网站发布报错(HTTP 错误 404 文件或目录未找到。Internet 信息服务(IIS)
- jquery 上传插件之极品 uploadify
- Eclipse + Pydev + Django + Mysql 环境搭建
- IIS部署asp.net报404错误
- android开源项目分享
- POJ 1256 全排列函数
- shell入门
- XCode4.5和它的Constrints
- 增加重做日志组
- Debian Linux 根目录 的 目录功能规划
- GetFocus
- hive 数据倾斜总结
- 《Spring技术内幕》学习笔记1——IoC容器体系结构
- Devexpress 设置颜色