Minimum number of mails required to distribute all the questions | Python3 code to find the minimum number of mails ; Function returns the min no of mails required ; Using the formula derived above ; no of questions ; no of students ; maximum no of questions a mail can hold ; Calling function
import math NEW_LINE def MinimumMail ( n , k , x ) : NEW_LINE INDENT m = ( ( n - 1 ) + int ( math . ceil ( ( n - 1 ) * 1.0 / x ) * ( n - 1 ) + math . ceil ( n * 1.0 / x ) * ( k - n ) ) ) ; NEW_LINE return m ; NEW_LINE DEDENT N = 4 ; NEW_LINE K = 9 ; NEW_LINE X = 2 ; NEW_LINE print ( MinimumMail ( N , K , X ) ) ; NEW_LINE