Number of Distinct Meeting Points on a Circular Road | Python3 Program to find number of distinct point of meet on a circular road ; Returns the number of distinct meeting points . ; Find the relative speed . ; convert the negative value to positive . ; Driver Code
import math NEW_LINE def numberOfmeet ( a , b ) : NEW_LINE INDENT ans = 0 ; NEW_LINE if ( a > b ) : NEW_LINE INDENT ans = a - b ; NEW_LINE DEDENT else : NEW_LINE INDENT ans = b - a ; NEW_LINE DEDENT if ( a < 0 ) : NEW_LINE INDENT a = a * ( - 1 ) ; NEW_LINE DEDENT if ( b < 0 ) : NEW_LINE INDENT b = b * ( - 1 ) ; NEW_LINE DEDENT return int ( ans / math . gcd ( a , b ) ) ; NEW_LINE DEDENT a = 1 ; NEW_LINE b = - 1 ; NEW_LINE print ( numberOfmeet ( a , b ) ) ; NEW_LINE