CT22164

Arjun's stamps Square Sum

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Caravans arrive at the lantern district of Glowfen with crates of stamps, and Arjun the paymaster must account for every last one. 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 <= 950; -1000000 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 41 -752317 -727000 -744550 -592934 -801415 -848987 -840930 -255373 -259020 -822156 -211766 -589601 -919180 -385900 -175182 -344567 -54441 -661237 -420104 -626466 -872728 -5403 -810369 -578707 -214148 -442885 -83653 -614965 -596586 -945867 -161440 -169811 -621239 -360317 -294039 -217581 -586273 -118335 -379424 -585713 -294182
Output: 12690534350383

Example 2:

Input: 929 -647998 -676863 -56125 -473232 -791204 -154631 -246453 -914680 -451378 -87682 -110908 -250285 -271077 -237225 -375749 -596110 -699153 -355330 -100100 -399129 -997033 -14754 -363655 -869155 -620520 -616154 -587207 -576140 -775444 -686421 -622511 -354530 -824342 -26357 -455980 -208821 -936127 -706020 -610218 -686821 76 -923193 -743455 -45292 -191549 -795444 -418345 -620986 -319364 -268960 -20882 -181816 -714047 -953305 -380373 -212608 -762230 -779782 -978208 -98177 -476947 -964391 -860805 -923808 -206496 -752246 -261653 -162390 -374060 -297572 -712551 -53925 -627827 -238592 -965714 -300522 -164117 -778862 -663012 -497354 -768271 -720140 -56510 -582093 -275386 -709982 -83338 -296190 -411075 -99616 -75435 -96184 -874473 -896466 -259243 -291633 -378667 -718640 -692942 -289173 -109059 -55442…
Output: 300507986211571

Example 3:

Input: 60 -405870 -925762 -385125 -760710 -588414 -561417 -862234 -104904 -68742 -737284 -100921 -868388 -904028 -874784 -525314 -255720 -755979 -19665 -191869 -32194 -734230 -388871 -350296 -486934 -435633 -999715 -554228 -228052 -589190 -272307 -537612 -403292 -755549 -120299 -411232 -164476 -797919 -613243 -497172 -453726 -416872 -326688 -51168 -277953 -634815 -233583 -242362 -74761 -583589 -825301 -20227 -355492 -966421 -627245 -530847 -872669 -528003 -355920 -664758 -659712
Output: 18413682037882

Constraints:

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

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