Tap here to switch tabs
Problem
Submissions

Problem: Find the Punishment Number of an Integer

med
30 min
Try to solve the Find the Punishment Number of an Integer problem.

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

med
30 min
Try to solve the Find the Punishment Number of an Integer problem.

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