ぼるじょあがC/C++の宿題を片づけますYO! 31代目
■ このスレッドは過去ログ倉庫に格納されています
0588デフォルトの名無しさん
NGNG#include <algorithm>
#include <iostream>
int factorial(int x){return x == 1 ? 1 : x * factorial(x - 1);}
int main()
{
int a[4] = {1, 2, 3, 4},
count = 0,
num_a = sizeof(a) / sizeof(a[0]),
end = factorial(num_a);
while(count++ < end)
{
for(int iter = 0; iter < num_a; ++iter)
std::cout << a[iter];
std::cout << std::endl;
std::next_permutation(a, a + num_a);
}
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています