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.

26 lines
522 B

#include <bits/stdc++.h>
using namespace std;
const int N = 10010;
int a[N];
void MeiGuiShu() {
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) a[i] = 1;
}
}
int main() {
MeiGuiShu();
int n, m;
cin >> n >> m;
MeiGuiShu();
for (int i = n; i <= min(m,9999); i++) {
if (a[i]) cout << i << endl;
}
return 0;
}