CT1241

The Silverfin Square Sum

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

It is audit day at the herring shoals of Silverfin. Arjun spreads the barrels records across the table and picks up a sharp pencil. 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 <= 39; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 16 -431182 -526204 -174344 -421489 -18731 -465430 -297077 -494253 -125692 -904207 -218070 -785596 -25334 -453423 -139200 -800190
Output: 3584393363810

Example 2:

Input: 1 -482026
Output: 232349064676

Example 3:

Input: 30 -826208 -1650 -192153 -429614 -209093 -711237 -347148 -711494 -51477 -615296 -518182 -618323 -7418 -645661 -510912 -818654 -297970 -105368 -882657 -969286 -930046 -507651 -388640 -334993 -127712 -605957 -591287 -524301 -334004 -385707
Output: 8933438691593

Constraints:

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

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