We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Mathematics
- Fundamentals
- Filling Jars
- Discussions
Filling Jars
Filling Jars
Sort by
recency
|
200 Discussions
|
Please Login in order to post a comment
!/bin/python3
import math import os import random import re import sys
def solve(n, operations): count = 0 for i in range(m): l = operations[i] a = l[0] b = l[1] k = l[2] count += (b-a+1)*k return count//n
if name == 'main': fptr = open(os.environ['OUTPUT_PATH'], 'w')
what is wrong with c++ solution why all the test cases are not passing
For C++ solution change the return type of solve function to long long and also type of result variable in main function from where solve is being called.
Java int array [ ] = new int[n]; for(List operation: operations){ int a = operation.get[0]-1; int b = operation.get[1]-1; int k = operation.get[2]; for(int i=a; i<=b; i++){ array[i]+= k; } }