18C.md (1300B)
1 Source: https://codeforces.com/problemset/problem/18/C 2 3 C. Stripe 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 64 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Once Bob took a paper stripe of *n* squares (the height of the stripe is 1 square). In each square he wrote an integer number, possibly negative. He became interested in how many ways exist to cut this stripe into two pieces so that the sum of numbers from one piece is equal to the sum of numbers from the other piece, and each piece contains positive integer amount of squares. Would you help Bob solve this problem? 22 23 Input 24 25 The first input line contains integer *n* (1 ≤ *n* ≤ 105) — amount of squares in the stripe. The second line contains *n* space-separated numbers — they are the numbers written in the squares of the stripe. These numbers are integer and do not exceed 10000 in absolute value. 26 27 Output 28 29 Output the amount of ways to cut the stripe into two non-empty pieces so that the sum of numbers from one piece is equal to the sum of numbers from the other piece. Don't forget that it's allowed to cut the stripe along the squares' borders only. 30 31 Examples 32 33 Input 34 35 ``` 36 9 37 1 5 -6 7 9 -16 0 -2 2 38 ``` 39 40 Output 41 42 ``` 43 3 44 ``` 45 46 Input 47 48 ``` 49 3 50 1 1 1 51 ``` 52 53 Output 54 55 ``` 56 0 57 ``` 58 59 Input 60 61 ``` 62 2 63 0 0 64 ``` 65 66 Output 67 68 ``` 69 1 70 ```