CT1398

The stamps Square Sum Puzzle

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Rune the paymaster watches over the mulberry rows of Silkmead's stores of stamps. A careful computation stands between order and chaos. Task: Read n integers and print the sum of their squares. Input format: First line: n. Second line: n space-separated integers. Output format: Print the sum of squares. Constraints: 1 <= n <= 60; 0 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 54 6482 7051 4007 3464 6596 4308 1217 5560 4414 4280 4173 3084 2713 4296 2869 5128 1508 9444 8734 7017 2722 6613 6087 8425 6762 7845 8344 4394 1959 4358 7409 6969 2198 2540 4709 4952 7730 7971 4732 2022 8914 5932 8745 5868 8624 6260 845 2079 929 723 5473 3910 2747 6448
Output: 1685619031

Example 2:

Input: 56 3297 6504 6400 1685 8684 3879 2103 749 8035 5534 2140 643 289 7909 2177 4415 2935 6905 7434 1219 914 1458 24 29 9224 8415 6527 1777 8740 2126 6799 538 4248 7088 6971 4313 9916 7076 9943 8141 5841 4409 299 3362 3478 7814 3274 8252 1781 7293 5039 4922 6692 3259 5538 1349
Output: 1684350959

Example 3:

Input: 18 7525 6815 8202 2448 463 2789 7240 9698 4674 5282 5163 7250 8726 3540 885 9042 8181 106
Output: 697917583

Constraints:

1 <= n <= 60; 0 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Loading...
Test Cases:No test cases
No test cases available.