Narcissistic numbers

In this exercice, we say that a natural number n with k digits is
narcissistic, when n is equal to the sum of the k-th power of its
digits. For example, 153 and 1634 are narcissistic numbers, as
153 = 1³ + 5³ + 3³ and 1634 = 1⁴ + 6⁴ + 3⁴ + 5⁴.

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 n is narcissistic or not.

Input

The input is formed by a non-empty sequence of natural numbers.

Output

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.

Problem information

Author: Unknown
Translator: Maria Serna

Generation: 2026-01-25T10:37:15.929Z

© Jutge.org, 2006–2026.
https://jutge.org
