像这种直接调用STL函数就能出结果的题,现在应该不会再出了吧。。。
/* * hdu3283/win.cpp * Created on: 2012-11-4 * Author : ben */ #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <ctime> #include <iostream> #include <algorithm> #include <queue> #include <set> #include <map> #include <stack> #include <string> #include <vector> #include <deque> #include <list> #include <functional> #include <numeric> #include <cctype> using namespace std; int main() { #ifndef ONLINE_JUDGE freopen("data.in", "r", stdin); #endif int T, t, len; char str[100]; scanf("%d", &T); while(T--) { scanf("%d", &t); printf("%d ", t); getchar(); gets(str); len = strlen(str); if(next_permutation(str, str + len)) { puts(str); }else { puts("BIGGEST"); } } return 0; }