为什么40分啊!!??

P1618 三连击(升级版)

zhangyan8216 @ 2023-12-02 21:53:13

#include <bits/stdc++.h>
using namespace std;
int b1[10];
int a, b, c;

void go(int x) {
    b1[x / 100] = 1;
    b1[x % 10] = 1;
    b1[x / 10 % 10] = 1;
}

bool check(int x, int y, int z) {
    memset(b1, 0, sizeof(b1));
    go(x);
    go(y);
    go(z);
    for (int i = 0; i <= 9; i++) {
        if (b1[i] == 0)
            return false;
    }

    return true;

}

int main() {
    cin >> a >> b >> c;
    int cnt;
    for (int x = 123; x <= 987; x++) {
        if (x * b % a || x * c % a)
            continue;
        else {
            int y = x * b / a ;
            int z = x * c / a ;
            if (check(x, y, z)) {
                cnt++;
                cout << x << ' ' << y << ' ' << z << ' ' << endl;
            }

        }
    }
    if (cnt == 0)
        cout << "No!!!";
    return 0;
}

by more_Power @ 2023-12-21 20:06:40

兄弟你找到原因了吗,我和你代码差不多,我也40分,但测试点都能过,不理解


|