✕
Variables and Data TypesCoding problems
Variables and Data Types: coding problems
Write a program that reads the input and prints the answer. Run checks it against every test, including hidden ones.
0 of 7 solved
A warehouse logs the daily change in stock for each of its bins. A bin can gain or lose up to one billion units in a day, and the manager wants the net change across all bins.
The total can be much larger than one billion, so a plain
intsum can overflow. Read the bins and print their total. Use alongfor the running sum.**Constraints:** n is at least 1 and at most 100000. Each value is between -1000000000 and 1000000000.
Input. The first line holds n. The second line holds n integers separated by spaces.
Output. One integer: the sum of all the values.
Example 1 input
3 1000000000 1000000000 1000000000
Output
3000000000
Example 2 input
4 -5 10 -20 15
Output
0