Files
python/TangDou/XiTi/1115.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

55 lines
1.3 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
//是不是0-5
bool isInRange(int n) {
//字典
unordered_map<int, int> _map = {{0, 1},
{1, 1},
{2, 1},
{3, 1},
{4, 1},
{5, 1}};
//小于100则返回false
if (n < 100) return false;
//判断百位
if (_map.count(n / 100) < 0) return false;
//判断十位
n = n % 100;
if (_map.count(n / 10) < 0) return false;
//判断个位
n = n % 10;
if (_map.count(n) < 0) return false;
return true;
}
//是不是0-5都有
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;
}