标签:wap ever space code for next nbsp rbegin aio
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int a[3] = { 1,3,2}; vector<int>num(a, a + 3); auto rfirst = num.rbegin(); auto rend = num.rend(); auto p = next(rfirst); while (p != rend && *p > *(prev(p))) ++p; if (p == rend) reverse(num.begin(), num.end()); else { for (auto i = rfirst; i!=rend; ++i) { if (*i > *p)swap(*i, *p); reverse(rfirst, i); } } for (auto i : num) { cout << i << " "; } system("pause"); return 0; }
标签:wap ever space code for next nbsp rbegin aio
原文地址:http://www.cnblogs.com/babyking1/p/6917035.html