In this exercice, we say that a natural number with digits is narcissistic, when is equal to the sum of the -th power of its digits. For example, 153 and 1634 are narcissistic numbers, as and .
A sequence of natural numbers is insufferably narcissistic when all the elements in the sequence are narcissistic numbers.
Write a program which, given a non-empty sequence of natural numbers, indicates whether it is insufferably narcissitic or not.
Your program must include, implement and use a function
bool is_narcissistic (int n);
indicating whether a natural is narcissistic or not.
The input is formed by a non-empty sequence of natural numbers.
The program has to indicate whether the sequence is insufferably narcissitic.
Follow the format described in the examples. Your code should follow the style rules and include the appropriate comments.
Author: Unknown
Translator: Maria Serna
Generation: 2026-01-25T10:37:15.929Z
© Jutge.org, 2006–2026.
https://jutge.org