You are viewing a single comment's thread. Return to all comments →
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')
first_multiple_input = input().rstrip().split() n = int(first_multiple_input[0]) m = int(first_multiple_input[1]) operations = [] for _ in range(m): operations.append(list(map(int, input().rstrip().split()))) result = solve(n, operations) fptr.write(str(result) + '\n') fptr.close()
Seems like cookies are disabled on this browser, please enable them to open this website
Filling Jars
You are viewing a single comment's thread. Return to all comments →
!/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')