poj 1256
2015-06-18 16:07
295 查看
需要自定义比较函数,否则AaBbc会出错
#include<iostream> #include<string.h> #include<math.h> #include<fstream> #include<algorithm> #include<stdio.h> #include<queue> #include<vector> #define MAXSIZE 100 using namespace std; const int MAXN = 1001; int n = 0; char s[14]; bool comp(char a, char b) { if (tolower(a) == tolower(b)) { return a < b; }else { return tolower(a) < tolower(b); } } int main() { freopen("data_1256.txt","r",stdin); while(scanf("%d", &n) != EOF) { for (int i = 0; i < n; i++) { scanf("%s", s); sort (s, s + strlen(s), comp); do { printf("%s\n", s); }while(next_permutation(s, s + strlen(s), comp)); } } return 0; }
相关文章推荐
- 织梦dedecms获取上一篇下一篇文章链接的方法
- Hbuilder编辑器怎么用 使用方法(wap静态页面测试)
- css3新特性
- Linux内核中等待队列的几种用法
- updateViewConstraints和updateConstraints
- LEK-Introduction
- for ..break和try ..catch
- 安装ORACLE时在Linux上设置内核参数的含义
- 简单的聊天应用,分析线程问题
- PHP将数组存入到数据库中
- 1.3. 关于注释
- hibernate工作总结
- 15.校验validation
- 兔子生兔子
- 第一阶段冲刺报告(六)
- MyBatis框架学习之增删改查
- java数据结题之-喝可乐的问题
- android判断相机图片朝向
- leetcode 9 -- Palindrome Number
- Linux卸载自带的apache