text: Minimum number of points required to cover all blocks of a 2 | Function to find the minimum number of Points required to cover a grid ; If number of block is even ; Return the minimum points ; Driver code ; Given size of grid ; Function call
code: def minPoints ( n , m ) : NEW_LINE INDENT ans = 0 NEW_LINE if ( ( n % 2 != 0 ) and ( m % 2 != 0 ) ) : NEW_LINE INDENT ans = ( ( n * m ) // 2 ) + 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans = ( n * m ) // 2 NEW_LINE DEDENT return ans NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = 5 NEW_LINE M = 7 NEW_LINE print ( minPoints ( N , M ) ) NEW_LINE DEDENT