You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
46 lines
1.3 KiB
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
int B[10];
|
|
|
|
void fenli(int x) {
|
|
while (x) {
|
|
int m = x % 10;
|
|
b[m]++;
|
|
x /= 10;
|
|
}
|
|
}
|
|
|
|
bool check(int x, int y, int z) {
|
|
memset(b, 0, sizeof b);
|
|
fenli(x), fenli(y), fenli(z);
|
|
//检查是不是每个位置都是1
|
|
for (int i = 1; i <= 9; i++)if (b[i] != 1) return false;
|
|
return true;
|
|
}
|
|
|
|
int main() {
|
|
int a, b, c;
|
|
bool found = false;
|
|
cin >> a >> b >> c;
|
|
for (int i = 1; i <= 9; i++)
|
|
for (int j = 1; j <= 9; j++)
|
|
for (int k = 1; k <= 9; k++) {
|
|
if (i != j && j != k && i != k) {
|
|
//构造第一个数字
|
|
int x = 100 * i + 10 * j + k;
|
|
//计算出第二个和第三个数字,可能不存在
|
|
int y = b * x / a;
|
|
int z = c * x / a;
|
|
if (y < 1000 && z < 1000) {
|
|
if (check(x, y, z)) {
|
|
found = true;
|
|
//检查是不是每个数字都用到了
|
|
printf("%d %d %d\n", x, y, z);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!found) cout << "No!!!";
|
|
return 0;
|
|
} |