UVA 146 ID Codes
生活随笔
收集整理的這篇文章主要介紹了
UVA 146 ID Codes
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
無恥地使用了STL,BS自己。
?關于next_permutation的用法:http://www.slyar.com/blog/stl_next_permutation.html
CODE:
?
?
#include?<iostream>#include?<algorithm>
#include?<cstdlib>
#include?<cstdio>
#include?<cstring>
using?namespace?std;
int?a[1001];
char?s[1001];
int?main()
{
????while(scanf("%s",?s)?&&?strcmp("#",?s))
????{
????????int?n?=?strlen(s);
????????for(int?i?=?0;?i?<?n;?i++)
????????????a[i]?=?s[i]-'A';
????????if(!next_permutation(a,?a+n))
????????????printf("No?Successor\n");
????????else
????????{
????????????for(int?i?=?0;?i?<?n;?i++)
????????????????printf("%c",?a[i]+'A');
????????????printf("\n");
????????}
????}
????return?0;
}
?
轉載于:https://www.cnblogs.com/g0feng/archive/2012/09/24/2700324.html
總結
以上是生活随笔為你收集整理的UVA 146 ID Codes的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: read write 返回值
- 下一篇: 45句忠告