AVLw @ 2023-09-18 22:06:56
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
bool arr[10] = { 0 };
typedef long long LL;
void divide(int n) {
arr[n % 10] = true;
arr[n / 10 % 10] = true;
arr[n / 100 % 10] = true;
}
bool check(int a, int b, int c) {
memset(arr, 0, sizeof(arr));
if (b > 987 || c > 987)
return false;
divide(a), divide(b), divide(c);
for (int i = 1; i <= 9; i++) {
if (!arr[i])
return false;
}
return true;
}
int main() {
LL a, b, c, x, y, z;
bool flag = false;
scanf("%lld %lld %lld", &a, &b, &c);
for (int x = 123; x <= 987; x++) {
if (!(x * b % a) && !(x * c % a)) {
y = x * b / a;
z = x * c / a;
if (check(x, y, z)) {
printf("%d %d %d\n", x, y, z);
flag = true;
}
}
}
if (!flag)
printf("No!!!");
return 0;
}
by yiban202241040105 @ 2023-09-22 16:45:42
判断输入含有0的情况
by AVLw @ 2023-09-26 20:50:05
@yiban202241040105 OK 通过了 谢谢