PECNUM- Editorial

PROBLEM LINK Peculiar Number

Author: Jeevansh Gagroo
Tester: Tanay Morakhia
Editorialist: Jeevansh Gagroo

DIFFICULTY

CAKEWALK - EASY

PREREQUISITES

Knowledge of General Mathematics, Basic Programming

EXPLANATION

Some observations:

  • Given 2 integers A and N. We find the power (AN=NUM).
  • Now we split the digits of integer NUM.
  • Now we add the digits of NUM and store in SUM.

For example: A and N are 5 and 3 respectively. So the num will be 125. Splitting the digits will result in three integers 1, 2 and 5. The sum will be 1+2+5=8.

The answer will be SUM = 8.

SOLUTIONS

C++ Solution: Peculiar Number C++ Solution
Python Solution: Peculiar Number Python Solution
Java Solution: Peculiar Number Java Solution