这中小数据可以用穷举法
排列:024,033,042,114,123,132,141,204,213,222,231,240,303,312,321,330,402,411,420
其中0开头3种,1开头4种,2开头5种,3开头4中,4开头3种,一起3+4+5+4+3 = 19种
组者饥合:024,033,114,123,222 总共埋世5种
#include <清唯cstdio>答空培#include <algorithm>
using namespace std
int main () {
int a[] = {1 , 2 , 3 , 4}
do {
亏轮for (int i = 0 i <4 ++i) printf ("%d " , a[i]) puts ("")
} while ( next_permutation (a , a+4) )
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)