CT27973

The crates Square Sum Puzzle

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Caravans arrive at the anvil district of Hammerfall with crates of crates, and Dorian the surveyor 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 <= 357; -1000000 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 103 -382239 -695034 -239967 -217517 -649806 -799063 -256273 -366027 -315275 -842399 -913780 -303410 -358136 -452090 -785647 -923054 -73788 971 -757799 -920193 -870220 -243407 -298967 -100113 -204580 -147470 -899289 -933437 -15350 -243143 -165196 -131445 -850280 -289071 -68481 -961732 -688512 -595515 -368883 -645822 -667132 -587024 -730114 -432581 -556540 -343133 -193089 -24126 -184475 -859256 -261849 -818211 -960401 -777567 -152987 -336242 -576236 -873646 -414202 -626037 -669810 -85607 -341193 -954475 -354959 -675917 -634175 -799094 -532501 -894027 -15370 -103054 -594906 -586870 -673821 -606021 -381198 -240503 -535963 -333452 -566434 -290379 -420627 -312911 -861419 -311626 -488709 -380004 -243611 -623512 -645003 -523338 -146388 -72171 -525493 -232179 -112719 -120200 -770252 -220609 -499726…
Output: 31869238436811

Example 2:

Input: 134 -396556 -897997 -623723 -534637 -196808 -28068 -926722 -553790 -712589 -307338 -240922 -485157 -682645 -815249 -477847 -693883 -221091 -522170 -540735 -898195 -321553 -702671 -725282 -377685 -717809 -982914 -242380 -947772 -380317 -727854 -259752 -938158 -657945 -31204 -672721 -913662 -377998 -14201 -796606 -100918 -687744 -237818 -819411 -880420 -850608 -919563 -905544 -42653 -218515 -156559 -668275 -33247 -403953 -462261 -808719 -806721 -222146 -300368 -174879 -118165 -322543 -25376 -366213 -360828 -778383 -664077 -756000 -951278 -129338 -949445 -849421 -685081 -652147 -44882 -986846 -877497 -915262 -224327 -692385 7459 -287760 -668008 -171707 -445554 -3901 -952408 -323638 -129902 -504824 -328936 -335318 -652811 -309323 -259919 -55132 -560447 -992602 -67366 -683889 -779355 -951837 -9…
Output: 47933735708113

Example 3:

Input: 229 -514950 -680705 -907412 -820433 -603869 -67544 -187783 -266409 -362776 -353140 -927138 -794673 -813542 -938566 -830041 -194025 -925775 -948189 -227970 -831960 -576964 -146000 -183036 -722833 -750065 -854375 -11185 -287269 -561402 -577479 -131492 -464137 -288584 -855177 -567749 -363460 -294275 -405592 -779343 -505683 -167677 -23693 -682911 -163104 -869982 -436590 -43303 -136934 -165250 -884946 -440716 -951127 -818954 -357291 -293951 -894894 -68958 -749747 -903195 -435458 -483109 -90531 -148675 -23186 -600453 -200908 -681422 -802051 -886822 -784445 -827981 -37392 -598583 -534094 -220068 -974735 -23596 -578336 -827160 -138372 -560174 -332200 -977611 -846042 -363112 -707281 -924090 -330515 -181133 -928654 -991466 -587798 -934392 -499222 -760593 -823798 -794575 -603987 -579221 -901536 -2581…
Output: 84975500364231

Constraints:

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

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