• + 0 comments

    I have a valid solution that cannot pass any of the tests. I have checked the output with other solutions that pass the hidden test cases. What am I doing wrong?

    def solve(a, b, c):
        # Write your code here
        
        M = max(a, b)
        m = min(a, b)
        
        A = max(0, min(M, c - m))
        B = max(0, min(c, M))
        H = max(0, min(c, m))
        
        nom = (A + B) * H
        denom = 2 * M * m
        
        gcd = math.gcd(nom, denom)
        return '%s/%s' % (nom // gcd, denom // gcd)