720
我的解答
/*******回溯法 也就是暴力解法 对于n(动态)个for循环,用递归求解*/
#include
#include
using std::cin;
using std::cout;
using std::string;
int b[6] = {0};
void q(string *a , int m, int k, int &result) {
if(m == k)
++result;
else {
for(size_t j = 0; j != a[m].size(); ++j){
int temp = a[m][j] - ‘0‘;
if(b[temp] == 0) {
b[temp] = 1;
q(a, m + 1, k, result);
b[temp] = 0;
}
}
}
}
int main() {
int num_E = 0, result = 0;
cin>>num_E;
string *work_Num = new string[num_E];//??????????????
for(int i = 0; i != num_E; ++i)
cin>>work_Num[i];
q(work_Num, 0, num_E, result);
cout<
return 0;
}