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.

55 lines
1.3 KiB

2 years ago
#include <bits/stdc++.h>
using namespace std;
//<2F>Dz<EFBFBD><C7B2><EFBFBD>0-5
bool isInRange(int n) {
//<2F>ֵ<EFBFBD>
unordered_map<int, int> _map = {{0, 1},
{1, 1},
{2, 1},
{3, 1},
{4, 1},
{5, 1}};
//С<><D0A1>100<30><30><EFBFBD>򷵻<EFBFBD>false
if (n < 100) return false;
//<2F>жϰ<D0B6>λ
if (_map.count(n / 100) < 0) return false;
//<2F>ж<EFBFBD>ʮλ
n = n % 100;
if (_map.count(n / 10) < 0) return false;
//<2F>жϸ<D0B6>λ
n = n % 10;
if (_map.count(n) < 0) return false;
return true;
}
//<2F>Dz<EFBFBD><C7B2><EFBFBD>0-5<><35><EFBFBD><EFBFBD>
bool include0To5(int a, int b) {
unordered_map<int, int> _zeroFive;
while (a) {
_zeroFive[a % 10]++;
a /= 10;
}
while (b) {
_zeroFive[b % 10]++;
b /= 10;
}
for (int i = 0; i <= 5; ++i) {
if (_zeroFive.count(i) == 0) return false;
}
return true;
}
int main() {
for (int i = 50; i <= 250; ++i) {
if (isInRange(i * 2) && isInRange(i * 4) && include0To5(i * 2, i * 4)) {
cout << i << " " << i << endl;
cout << i * 2 << " " << i * 4 << endl;
}
}
return 0;
}