80分求助!!!!
查看原帖
80分求助!!!!
1090508
511017802yrb楼主2023/12/20 20:36
#include<iostream>
#include<algorithm>
using namespace std;
int a, b, c;
int flag = 0;
void check(int p) {
	bool ak[10] = { 0 };
	int i = p,j = i / a * b, h = i / a * c;
	int p1 = j, p2 = h;
	if (p1 > 1000 || p2 > 1000 || p1 < 100 || p2 < 100)return;
	while (i) {
		ak[i % 10] = 1;
		i /= 10;
	}
	while (j) {
		ak[j % 10] = 1;
		j /= 10;
	}while (h) {
		ak[h % 10] = 1;
		h /= 10;
	}
	for (i = 1; i < 10; i++) {
		if (ak[i] == 0)return;
	}
	cout << p << " " << p1 << " " << p2 << endl;
	flag = 1;
}
int main(){
	cin >> a >> b >> c;
	int i;
	for (i = 123; i <= 987; i++) {
		check(i);
	}
	if(flag == 0)cout<<"No!!!";
	return 0;
}
2023/12/20 20:36
加载中...