Senin, 09 Januari 2017

SPOJ 3410 - SAMER08F Solution

Problem Statement: Feynman

Explanation

Find the pattern and you can solve this problem easily.
if N = 1, Result = 1^2.
if N = 2, Result = 1^2 + 2^2.
if N = 3, Result = 1^2 + 2^2 + 3^2.
if N = 4, Result = 1^2 + 2^2 + 3^2 + 4^2.
and so on.

Source Code

Tidak ada komentar:

Posting Komentar