Gandhian Series
CodeChefOpen on judge ↗
A Britisher challenged Mahatma Gandhi to solve a series if he wants India free from British rule. Gandhi is good with philosophies but weak in maths problem-solving. Given two numbers $N$ and $K$. Find $S$= $\sum_{i=1}^{n} i^k$ $+$ $\sum_{j=1}^{k} ( ( j \bmod 2 ) -1 ) \times j$. For example: If $N=6$ and $K=6$, then $S$= $1^k+(2^k-2)+(3^k)+(4^k-4)+5^k+(6^k-6)$. ###Input: - First-line will
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start