add things-add-up

This commit is contained in:
Jacob Magnuson 2017-02-17 06:27:24 +00:00
parent 42d7c6646b
commit b03d27ff07
5 changed files with 38 additions and 1 deletions

View file

@ -1,5 +1,5 @@
title: Fizz Buzz 1 title: Fizz Buzz 1
category: Programming category: Programming
value: 10 value: 30
author: wiresboy author: wiresboy
autogen: false autogen: false

View file

@ -0,0 +1,24 @@
For this problem you will utilise the programming interface, which you can access via the navigation bar at the top of your screen.
The input for your program will be given via STDIN - that's `cin`, `input()`, and `System.in` for cxx, Python, and Java respectively.
Output goes to STDOUT - `cout`, `print`, and `System.out`. Your program will be run on several sets of input, and if your output matches
ours for each testcase, this problem will be marked solved.
We'll start with a simple challenge. Each testcase has two lines of input. The first will contain an integer `N`. The second will contain a
series of integers `a_1, a_2, ..., a_N`. You are to output the sum of all of these integers. Good luck!
#### Input Constraints
`0 < N < 100`
`-1000 < a_i < 1000`
#### Sample Input
```5
1 2 3 4 5
```
#### Sample Output
`15`

View file

@ -0,0 +1,5 @@
cases = ['5\n1 2 3 4 5', '25\n579 356 251 414 23 -480 -451 -49 983 -458 678 847 -342 -497 336 478 -444 35 -103 964 97 838 306 -559 214', '30\n-480 -703 -935 -137 -13 -934 818 -99 105 178 -590 -420 240 289 467 -700 -663 21 241 393 -923 -711 492 857 -966 380 498 761 -60 -809', '69\n806 345 443 -897 597 488 -269 503 -344 873 -774 -922 610 -742 678 -227 852 886 392 443 -100 219 -690 795 -280 -550 -960 -415 -144 -408 -977 -281 -730 761 947 275 -692 -635 -456 888 -120 749 496 580 256 164 -51 -623 -83 -384 635 103 -260 569 684 -392 -876 93 52 751 -74 523 475 3 307 933 -469 -1 -419', '80\n-173 934 907 -330 863 544 383 138 -211 -675 -463 550 -735 -548 664 129 302 925 -446 -616 -855 -149 -667 -757 -594 802 400 -525 -315 482 818 -893 509 -600 -523 -909 560 -499 544 -897 -192 -669 47 -702 182 -590 164 -599 336 68 -304 961 37 -92 -966 -896 -364 173 -826 -54 -669 69 509 198 960 -206 167 737 -422 370 83 183 -462 201 -984 13 700 -977 116 161', '98\n719 -829 -388 109 843 958 555 923 -411 610 737 687 -945 943 200 -793 -699 -818 464 -469 186 -45 573 -615 -283 -224 359 152 -905 222 -736 -823 543 667 394 -808 25 360 -451 -500 -395 -670 421 -380 86 -638 -379 94 -315 191 805 -471 541 689 266 177 -185 -309 -469 620 -379 -948 -455 -184 606 509 335 293 -560 -971 -267 144 -70 688 116 862 -687 460 3 -311 814 -994 869 731 631 206 648 -501 -12 -603 -705 -760 -273 -780 -410 82 915 -227', '38\n98 408 -83 -856 721 590 -393 647 -661 494 -30 -950 514 25 -853 850 -141 -160 326 -525 600 -954 919 802 301 -627 -680 276 -645 -299 557 -372 463 -576 766 617 285 336', '52\n-261 -303 -70 450 751 -635 12 -162 91 224 868 -559 -510 -280 911 -754 -73 535 417 -867 843 -930 -372 -284 822 172 -575 -507 -602 383 290 -456 914 68 682 234 635 -872 -213 549 106 -533 -397 362 -395 -676 369 725 292 -375 -762 544', '17\n-165 816 -699 102 -248 -744 763 -12 -660 715 896 423 487 499 433 -192 -926', '59\n-801 -974 -633 -334 -756 -601 -711 32 -417 442 -94 419 -126 721 -831 612 -518 -318 -590 -109 693 196 -755 880 358 -491 -476 -394 749 54 -54 -715 -946 -113 -707 -817 21 -305 855 -975 272 259 -950 -447 798 80 601 -959 382 -137 443 235 -505 -435 -848 34 147 -358 369', '41\n894 948 -870 862 -657 -266 -408 198 -177 -721 51 -257 -135 287 631 537 -183 628 -519 -385 950 264 -318 481 471 -997 589 -196 868 -932 747 -596 296 145 669 169 -123 837 507 -149 3', '1\n-329', '68\n-381 -42 840 312 -422 -305 545 -981 -309 780 324 182 588 -520 151 -105 644 105 -826 834 -967 -852 -192 998 -381 -48 912 -498 508 -959 930 291 -894 -544 -154 -545 400 -507 605 968 265 294 -38 -870 -929 -138 791 266 482 -601 -872 9 -923 494 -552 -983 320 750 -950 -102 -240 218 -435 -927 -696 985 436 85', '77\n328 5 -70 221 -942 221 -283 461 610 -515 364 -263 91 634 -233 -21 -230 571 -414 671 -266 -877 137 -712 420 -932 600 -745 191 -14 182 964 856 -116 -678 697 -406 -820 -498 -78 420 -930 -258 -639 98 -341 242 -885 952 999 938 625 -646 -596 471 -405 559 -432 -642 -837 253 -304 -636 -703 -999 936 -265 -792 -391 194 -411 199 -852 -193 -327 84 -287', '37\n-534 528 781 27 868 763 135 -991 964 698 103 955 448 79 440 860 584 949 380 222 518 920 -902 -270 506 -450 -813 -129 -993 41 992 535 730 -876 -773 0 -829']
C = input()
print cases[C]

2
things-add-up/grader.py Normal file
View file

@ -0,0 +1,2 @@
n = input()
print sum(int(y) for y in raw_input().strip().split(' '))

View file

@ -0,0 +1,6 @@
author: blockingthesky
title: Things Add Up
category: Programming
autogen: false
programming: true
value: 15