Tap here to switch tabs
Problem
Submissions

Problem: Find the Punishment Number of an Integer

Find the Punishment Number of an Integer by summing the squares of values from one to the given integer whose squared decimal strings can be split into contiguous parts totaling the original value.

Statement

Given a positive integer n, return the punishment number of n.

The punishment number of n is defined as the sum of the squares of all integers i satisfying 1≤i≤1 \leq i \leq n, such that the decimal string representation of iimesii imes i can be partitioned into contiguous substrings whose integer values sum to ii.

Constraints:

  • 1≤1 \leq n ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Punishment Number of an Integer

Find the Punishment Number of an Integer by summing the squares of values from one to the given integer whose squared decimal strings can be split into contiguous parts totaling the original value.

Statement

Given a positive integer n, return the punishment number of n.

The punishment number of n is defined as the sum of the squares of all integers i satisfying 1≤i≤1 \leq i \leq n, such that the decimal string representation of iimesii imes i can be partitioned into contiguous substrings whose integer values sum to ii.

Constraints:

  • 1≤1 \leq n ≤1000\leq 1000