This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include <bits/stdc++.h>
using namespace std;
const int N = 10010;
int b[N];
void MeiGuiShu() {
// 枚举出所有4位数的玫瑰花数,利用桶进行保存
for (int i = 1000; i <= 9999; i++) {
int x = i, sum = 0;
while (x) {
int a = x % 10;
x /= 10;
sum += a * a * a * a;
}
if (sum == i) b[i] = 1;
int main() {
// 标识玫瑰数
MeiGuiShu();
int n, m;
cin >> n >> m;
for (int i = n; i <= min(m, 9999); i++)
if (b[i]) cout << i << endl;
return 0;