2698. Find the Punishment Number of an Integer
Given a positive integer
n
, return the punishment number ofn
.The punishment number of
n
is defined as the sum of the squares of all integersi
such that:
1 <= i <= n
- The decimal representation of
i * i
can be partitioned into contiguous substrings such that the sum of the integer values of these substrings equalsi
.
c++
1 | class Solution { |