Find all the divisors of the given number NN:

\\To find the divisors of NN, we can iterate from 11 to the square root of NN. If dd is a divisor of NN, then N/dN/d is also a divisor of NN. We need to consider both dd and N/dN/d as divisors. If dd and N/dN/d are the same, we only need to consider one of them. \\\\Calculate the sum of digits for each divisor:

\\For each divisor, we can calculate the sum of its digits by repeatedly extract the last digit by using the remainder of division by 1010, add it to the sum and remove the last digit by dividing the number by 1010. Repeat this process while number greater than 00.

\\Don’t forget to keep track of the maximum sum of digits encountered. The time complexity of this approach is O(n\sqrt{n}) for each test cases.

Statistics

93% Solution Ratio
ItzRAYEarliest, 11M ago
user.4356Fastest, 0.0s
dodo_codoLightest, 4.9 MB
ItzRAYShortest, 532B
Toph uses cookies. By continuing you agree to our Cookie Policy.