Animesh has empty candy jars, numbered from to , with infinite capacity. He performs operations. Each operation is described by integers, , , and . Here, and are indices of the jars, and is the number of candies to be added inside each jar whose index lies between and (both inclusive).
Can you tell the average number of candies after operations?
The array has elements that all start at . In the first operation, add to the first elements. Now the array is . In the second operation, add to the last elements (3 - 5). Now the array is and the average is 10. Sincd 10 is already an integer value, it does not need to be rounded.
Complete the solve function in the editor below.
solve has the following parameters:
int n: the number of candy jars
int operations[m]: a 2-dimensional array of operations
int: the floor of the average number of canidies in all jars
The first line contains two integers, and , separated by a single space.
lines follow. Each of them contains three integers, , , and , separated by spaces.