http://projecteuler.net/problem=24 "0123456789"の順列の1000,000番目を求める。 next_permutationまわすだけ。 {{{#!highlight c++ #include #include using namespace std; int main() { string s = "0123456789"; int counter = 0; do { counter++; if (counter == 1000000) break; } while (next_permutation(s.begin(), s.end())); cout << s << endl; return 0; } }}}