求助,ce
查看原帖
求助,ce
1240173
zhishisen楼主2024/10/19 10:51
#include <iostream>
#include <algorithm>
using namespace std;

int arr[10] = {0,1,2,3,4,5,6,7,8,9};

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    int cnt;
    do {
    	int x = arr[1] * 100 + arr[2] * 10 + arr[3];
    	int y = arr[4] * 100 + arr[5] * 10 + arr[6];
    	int z = arr[7] * 100 + arr[8] * 10 + arr[9];
        if ((x * b == y && x * c == z) || (x == a && y == b && z == c))
        {
            printf("%d %d %d\n", x, y, z);
            cnt ++;
        }
    } while(next_permutation(a+1, a+10));
    if (cnt == 0)
    {
        cout << "No!!!";
    }
    return 0;
}
2024/10/19 10:51
加载中...