100分求助

P1618 三连击(升级版)

zhangchenyi_10_old @ 2024-12-08 08:23:21

#include <bits/stdc++.h>
using namespace std;
long long a, b, c;
bool flag = true;
long long x;
inline bool duplicate_removal(long long i, long long j, long long k) {
    bool ok[20];
    memset(ok, 0, sizeof(ok));
    while (i > 0) {
        ok[i % 10] = true;
        i /= 10;
    }
    while (j > 0) {
        ok[j % 10] = true;
        j /= 10;
    }
    while (k > 0) {
        ok[k % 10] = true;
        k /= 10;
    }
    for (int i = 1; i <= 9; i++) {
        if (!ok[i]) {
            return false;
        }
    }
    return true;
}
int main() {
    scanf("%lld %lld %lld", &a, &b, &c);
    for (long long i = 100; i <= 999; i++) {
        long long j = i * b / a;
        long long k = i * c / a;
        if (duplicate_removal(i, j, k) && j <= 999 && k <= 999 && i <= 999) {
            printf("%lld %lld %lld\n", i, j, k);
            flag = false;
        }
    }
    if (flag) {
        printf("No!!!");
        return 0;
    }
    return 0;
}

必关


by wzj1105 @ 2024-12-08 08:33:31

?


by cff_0102 @ 2024-12-08 08:38:48

@zhangchenyi_10_old a=0


by zhangchenyi_10_old @ 2024-12-08 09:23:58

@cff_0102 什么意思


by cff_0102 @ 2024-12-08 09:32:09

@zhangchenyi_10_old 你没有处理a=0的情况


by zhangchenyi_10_old @ 2024-12-08 10:02:16

thank $ $ you

|