1 solutions
-
0thakuremon LV 4 @ 2024-03-12 09:12:13
Suppose pritom has N chocolate, in each of the way he chose \(X1,X2,X3...\) friends to distribute the chocolate.
for \(Xi\) number of chosen friends each of the friends will get \(N/Xi\) amount of chocolate each. Since the number of chocolate each friend gets must be an integer so \(Xi\) must be a divisor of N.so every \(Xi\) must be a divisor of N. finally we can conclude that the answer will be the total number of divisort of N.
time complexity : O(sqrt(N))
- 1
Information
- ID
- 1037
- Difficulty
- 3
- Category
- Beginners Click to Show
- Tags
- (None)
- # Submissions
- 57
- Accepted
- 27
- Accepted Ratio
- 47%
- Uploaded By