排列(permutation):用1,2,3,...,9组成3个三位数abc, def和ghi,每个数字恰好使用一次,要求abc:def:ghi = 1:2:3。输出所有解。提示:不必太动脑筋。

#include

//分解三位数,数组相应位置值加一 
int fun(int t[],int i)
{
 t[i/100]++;
 t[(i % 100)/10]++;
 t[i % 10]++;
}

//将数组置为0 
void clearArray(int t[],int l)
{
 int i;
 for(i=0;i

你可能感兴趣的:(C&C++)