POJ 1146】的更多相关文章

ID Codes Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 6281 Accepted: 3769 Description It is 2084 and the year of Big Brother has finally arrived, albeit a century late. In order to exercise greater control over its citizens and thereby…
// 求下一个排列// 如果已经是最后一个排列// 就输出 No Successor// stl 或 自己写个 生成排列 我测试了下 两个速率是一样的.只是代码长度不同 /* #include <iostream> #include <string> #include<sstream> #include <cmath> #include <map> #include <stdio.h> #include <string.h>…
/* * 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…
来源:点击打开链接 求字典序下一位,没有直接输出没有.全排列函数秒水过. #include <iostream> #include <algorithm> #include <cstring> #include <string> using namespace std; int main() { int testcase; string tar; while(cin>>tar && tar!="#") { if…
#include <iostream> #include <algorithm> #define MAXN 55 using namespace std; char _m[MAXN]; int main() { //freopen("acm.acm","r",stdin); int i; while(cin>>_m) { ) { break; } if(next_permutation(_m,_m+strlen(_m))) { ;…
ID Codes Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 6229   Accepted: 3737 Description It is 2084 and the year of Big Brother has finally arrived, albeit a century late. In order to exercise greater control over its citizens and ther…
题目大意:输入一个字符串.输出它的下一个字典序排列. 字典序算法思想: 1.从右向左寻找字符串找出第一个a[i]<a[i+1]的位置i; 2.从右向左找出第一个大于a[i]的元素a[j]; 3.swap(a[i],a[j]) 4.将a[i+1]......到a[stelen(a)]倒序 5.输出a 代码例如以下: #include<iostream> #include<cstdio> #include <cstring> #include<algorithm…
ID Codes Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 7644   Accepted: 4509 Description It is 2084 and the year of Big Brother has finally arrived, albeit a century late. In order to exercise greater control over its citizens and ther…
Log 2016-3-21 网上找的POJ分类,来源已经不清楚了.百度能百度到一大把.贴一份在博客上,鞭策自己刷题,不能偷懒!! 初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. (5)构造法.(poj3295) (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996) 二.图算法: (1)图的深度优先遍历和广度优先遍历. (2)最短路…
初期:一.基本算法:     (1)枚举. (poj1753,poj2965)     (2)贪心(poj1328,poj2109,poj2586)     (3)递归和分治法.     (4)递推.     (5)构造法.(poj3295)     (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法:     (1)图的深度优先遍历和广度优先遍历.     (2)最短路径算法(dijkstra,bellman-ford,floyd,hea…