最后一个点过不了,求大佬帮忙看一下
查看原帖
最后一个点过不了,求大佬帮忙看一下
1293940
Yone00楼主2024/4/12 15:42
#define  _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
int a, b, c;
string s;
bool check(int n,int m,int x) {
	if (m >= 1000 || x >= 1000)
		return false;
	s = to_string(n);
	s += to_string(m);
	s += to_string(x);
	sort(s.begin(), s.end());
	if (s[0] - '0' == 1 && s[1] - '0' == 2 && s[2] - '0' == 3 && s[3] - '0' == 4 && s[4] - '0' == 5 && s[5] - '0' == 6 && s[6] - '0' == 7 && s[7] - '0' == 8 && s[8] - '0' == 9)
		return true;
	else
		return false;

}
int main() {
	int flag = 0;
	cin >> a >> b >> c;
	for (int i = 100; i < 1000; i++) {
		if (check(i, i * b, i * c)) {
			cout << i << " " << i * b << " " << i * c << endl;
			flag = 1;
		}
	}
	if (flag == 0)
		cout << "No!!!";
	return 0;
}
2024/4/12 15:42
加载中...