这是刘汝佳暴力的第一题,枚举除数,感觉还是比较简单的,本来就是普及-的题
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pa;
int main() {
int n;
int output = 0;
while (cin >> n && n) {
if (output++) cout << endl;
vi v;
for (int i = 0; i < 10; i++) v.pb(i);
vector<pa> ans;
for (int i = 1234; i <= 50000; i++) {
if (i * n >= 100000) break;
vi vv;
int num = i * n;
int t = i;
for (int j = 0; j < 5; j++) { vv.pb(t % 10); t /= 10; }
for (int j = 0; j < 5; j++) { vv.pb(num % 10); num /= 10; }
sort(all(vv));
if (vv == v) ans.pb(mk(i * n, i));
}
if (!sz(ans)) { cout << "There are no solutions for " << n << ".\n"; continue; }
for (int i = 0; i < sz(ans); i++) printf("%d / %05d = %d\n", ans[i].fi, ans[i].se, n);
}
return 0;
}