Created
September 4, 2025 19:08
-
-
Save pythoninthegrass/94b40f81428acb17e538cd6735cd2efd to your computer and use it in GitHub Desktop.
codingame.com - sum of squared numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| INPUT: | |
| Line 1: An integer N for the amount of numbers to use. | |
| Line 2: A line containing N space-separated integers Xi. | |
| OUTPUT: | |
| The sum of the squares of the Xi numbers. | |
| CONSTRAINTS: | |
| 0 < N < 100 | |
| -1000 < Xi < 1000 | |
| Input | Output | |
| --------|------- | |
| 3 | 14 | |
| 1 2 3 | 1 4 9 | |
| """ | |
| n = int('3') | |
| sum_of_squares = 0 | |
| for i in '1 2 3'.split(): | |
| xi = int(i) | |
| sum_of_squares += xi**2 | |
| print(sum_of_squares) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment