CT26664

The Square Sum of the Roving lanterns

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Caravans arrive at the lantern lake of Firefly Mere with crates of lanterns, and Felix the inventory keeper 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 <= 477; -100 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 146 9952 6451 5625 3198 1015 2704 4361 3253 848 9267 1187 3752 1641 4645 6815 5584 3966 7927 9594 3233 7280 4821 1922 6406 2200 1237 155 3717 5546 8241 891 1532 8333 580 5554 3510 7247 8899 8569 7628 3583 3728 227 1997 1899 4818 4480 7196 2982 923 5161 674 6604 3727 4428 136 3664 1080 9992 4404 3086 5222 6105 9835 5741 2848 2847 7769 5611 4618 1696 9625 60 8598 5852 3792 8390 5540 5935 9926 4314 4375 4880 2878 9643 1014 3793 2872 9321 7841 5801 7889 2473 7770 5317 2809 4399 2788 5799 4955 7294 6422 5185 5639 7938 909 3720 5172 272 2469 5517 8322 8771 8401 448 1679 2087 7554 4165 8148 9123 9280 6593 7716 4705 4876 7498 4852 3653 7580 7581 2421 7042 643 3386 9285 5792 9095 2085 6922 9593 8766 7064 5042 4313 9299
Output: 4863479233

Example 2:

Input: 130 9183 8761 5953 6971 3089 6915 9590 2554 540 5212 9880 7487 854 3460 4928 5298 6388 7174 2041 7018 6267 6474 964 3671 4024 7415 3169 1418 2458 1658 3735 9569 8796 1059 7319 386 1737 6990 7888 8802 114 8271 4295 9470 8901 4282 4613 1984 5035 8728 5462 7488 908 3308 1402 9867 5128 8856 4031 8158 439 6330 4547 4207 7475 5551 5711 6053 5751 5222 3092 6289 318 2081 6235 9578 1748 8090 3444 9963 9326 3179 4724 4158 6318 6067 7566 4411 2194 7828 549 3013 1535 6562 4429 6336 9380 2207 4035 7900 3097 5544 7942 9000 4644 173 7774 5956 2593 1696 6558 6786 218 2394 1941 1974 1560 8105 9425 6748 750 7470 800 3521 1429 1793 7677 6664 3287 6337
Output: 4341603413

Example 3:

Input: 324 9620 3231 8425 782 6514 4656 7567 6399 2395 1291 3609 451 5810 2697 1243 8665 6929 5494 3114 9132 4979 5201 6359 5110 3501 5770 3847 9710 5009 6879 3778 5963 -69 2097 8006 6526 4555 9400 9267 4212 2528 7647 3511 4462 168 2483 473 5897 6734 289 4969 9470 5361 9403 2404 4539 5117 8413 8235 7653 4955 3507 6210 1236 9604 2467 2294 9822 8776 1375 1657 5407 5690 7379 5641 3046 8134 8663 -99 7192 6266 6371 1319 6943 4225 4782 9274 4741 4325 7080 4003 1807 5568 9903 4968 2472 546 955 9438 3836 4379 2162 9575 7505 2423 1905 315 4252 6387 82 482 1937 856 7742 6313 9345 6102 7469 120 7318 2208 3514 1253 9083 8075 1752 2503 2442 2634 445 4629 1847 6549 8524 2149 3896 1594 6733 6605 8496 4670 6296 7868 2844 6479 4146 2668 6826 3746 9794 3344 4979 636 -72 4504 5647 9980 360 5420 6954 2878 6073 1761 …
Output: 10422977823

Constraints:

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

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