提交时间:2024-11-15 15:51:43

运行 ID: 56727

#include <iostream> #include <cmath> using namespace std; bool isQuadraticRose(int n) { int a = n / 1000; int b = (n % 1000) / 100; int c = (n % 100) / 10; int d = n % 10; return n == pow(a, 4) + pow(b, 4) + pow(c, 4) + pow(d, 4); } int main() { int N, M; cin >> N >> M; for (int i = N; i <= M; i++) { if (isQuadraticRose(i)) { cout << i << " "; } } return 0; }