运行错误,求助

P1618 三连击(升级版)

LGC071030 @ 2021-07-29 11:31:20

#include <iostream>
#include <cstdio>
#include <cstring>

int b[10];

void go(int x) {
    b[x % 10] = 1;
    b[x / 10 % 10] = 1;
    b[x / 10] = 1;
}
bool check(int x, int y, int z) {
    memset(b, 0, sizeof(b));
    if (y > 999 || z > 999) return 0;
    go(x);
    go(y);
    go(z);
    for (int i = 1; i <= 9; ++ i) {
        if (!b[i]) return 0;
    }
    return 1;
}

int main() {
    int a, b, c, x, y, z, cnt = 0;
    scanf("%d%d%d", &a, &b, &c);
    for (x = 123; x <= 987; ++ x) {
        if (x * b % a || x * c % a) continue;
        y = x * b / a;
        z = x * c / a;
        if (check(x, y, z)) {
            printf("%d %d %d\n", x, y, z);
            ++ cnt;
        }
    }
    if (!cnt) printf("No!!!");
    return 0;
}

|