我必须在 C++ 应用程序中找到使用 3 个整数而不重复的所有组合。
当我指定我有多少个整数时,我可以计算出将有多少个组合。
unsigned int combinations(unsigned int n){
return ((n/3) * ((n-1)/2) * (n-2));
}
但是我怎样才能添加到vector所有的组合中呢?fe 使用:1, 2, 3, 4: 123, 234, 124, 134. 顺序不重要,与123相同321。