While using this code:
for(int i=0; i<line; i++) {
next_permutation(nums, nums+N);
if(DEBUG) {
for(int j=0; j<N; j++) {
cout << nums[j] << " ";
}开发者_如何转开发
}
}
I am getting this output: -1076591092_1_2_4_3_-1076591092_1_3_2_4_
Int his case, line would be 3, and N is 5; Thanks!
[-1076591092, 1, 3, 2, 4]
is the next permutation after [-1076591092, 1, 2, 4, 3]
, according to definition.
The problem is related to poor memory management.
精彩评论