Editorial for Mr. White's Carnival


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.

Author: Rimuru

It suffices to loop from 1 to N and check if each number is divisible by N. If the number is divisible by N, then add it to a variable containing the total sum of all factors.

Note that a number is a factor of N if it N mod i is equal to 0.

Time Complexity: \mathcal O(n)


Comments

There are no comments at the moment.