(组合数学3.1.1.1)POJ 1146 ID Codes(字典序法)
来源:互联网 发布:mumu模拟器网络异常 编辑:程序博客网 时间:2024/05/18 01:58
/* * POJ_1146.cpp * * Created on: 2013年10月8日 * Author: Administrator */#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>using namespace std;char s[60];int l;bool get(){int i = l - 1;int j;while(i > 0 && s[i-1] >= s[i]){i--;}if(!i){return false;}int mp = i;for(j = i + 1 ; j < l ; ++j){if(s[i-1] >= s[j]){continue;}if(s[j] < s[mp]){mp = j;}}swap(s[mp],s[i-1]);sort(s+i,s+l);return 1;}int main(){while(scanf("%s",&s)!=EOF,s[0] !='#'){l = strlen(s);if(get()){printf("%s\n",s);}else{printf("No Successor\n");}}}
- (组合数学3.1.1.1)POJ 1146 ID Codes(字典序法)
- POJ 1146 ID Codes 求下一个字典序
- 【POJ】1146 - ID Codes(字符串下一个字典序)
- POJ1146 ID Codes 字典序法
- poj 1146 ID Codes
- POJ 1146 ID Codes
- poj 1146 ID Codes
- poj 1146 ID Codes
- POJ 1146 ID Codes
- POJ 1146:ID Codes
- poj 1146 ID Codes
- ID Codes POJ - 1146
- poj Code(组合数学 字典序)
- POJ 1146 ID Codes (STL)
- ACM POJ 1146 ID Codes
- ID Codes(poj 1146)
- POJ 1146 ID Codes 笔记
- UVa 146 ID Codes (字典序)
- PK FK 命令小记
- c# asp.net 修改webconfig文件 配置
- MySQL大战SQLite和PostgreSQL(比拼、比较)
- android 源码环境下编译adb emulator windows版本
- linux面试题参考答案(转)
- (组合数学3.1.1.1)POJ 1146 ID Codes(字典序法)
- 6年没碰过代码了,又重操旧业了
- 同时验证手机号码和固定电话的正则表达式
- ADO 连接数据库
- Graphics Pipeline
- 2014年合肥市国内某网络公司B的面试编程题
- Power-Aware Message Propagation Algorithm
- hadoop面试题
- Linux环境下段错误的产生原因及调试方法小结