#include<iostream> #include<algorithm> using namespace std;
int tar, num=0; int a[10] = { 1,2,3,4,5,6,7,8,9 }; int b[10] = { 1,2,3,4,5,6,7,8,9 };
intmain() { cin >> tar; while (1) { //first 找分割线 int x = 0; for (int i = 0; i < 7; i++) { //second x = x * 10 + a[i]; int y = 0; for (int j = i + 1; j < 8; j++) { y = y * 10 + a[j]; int z = 0; for (int k = j + 1; k < 9; k++) z = z * 10 + a[k]; if (x + (y / z) == tar && y % z == 0) num++; //cout << "x: " << x << " y: " << y << " z: " << z << endl; }
}
next_permutation(a, a + 9);//全排列数组的某一部分 //cout << "new a:"; /* for (int i = 0; i < 9; i++) { cout << a[i]; } cout << endl;*/
bool flag = 0; for (int i = 0; i < 9;i++) { if (a[i] != b[i]) { flag = 1; break; } }