fish_gugu @ 2023-04-20 20:29:09
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int cnt[10];
void chai(int x)
{
while (x > 0)
{
cnt[x % 10]++;
x /= 10;
}
}
bool chk(int x, int y, int z)
{
memset(cnt, 0, sizeof(cnt));
if (y > 999 || z > 999) return false;
chai(x);
chai(y);
chai(z);
for (int i = 1;i <= 9;i++)
{
if (cnt[i] != 1)
{
return false;
}
}
return true;
}
int main()
{
int a, b, c;
cin >> a >> b >> c;
bool no = true;
for (int x = 100; x <= 999; x++)
{
if (x * b % a != 0 || x * c % a != 0) continue;
int y = x * b / a;
int z = x * c / a;
if (chk(x, y, z))
{
cout << x << " " << y << " " << z << endl;
no = false;
}
}
if (no) cout << "No!!!" << endl;
return 0;
}
by Sharp_ @ 2023-04-29 11:15:39
这个数据点A为0,但是除数不能为0,出现错误了,考虑这一点直接输出No!!!就可以了