code_practice

Hackerrank 레벨업 하기24 [Cats and a Mouse]

  • By Khel Kim, 김현호
  • 20 Jan 2019
  • Tags : coding_practice

Hackerrank 레벨업하기
문제
Cats and a Mouse

def catAndMouse(x, y, z):
    dist = [abs(x-z), abs(y-z)]
    if dist[0] == dist[1]:
        return 'Mouse C'
    else:
        if dist.index(min(dist)) == 0:
            return 'Cat A'
        else:
            return 'Cat B'

궁금하신게 있다면 메일 주세요.
k2h7913@daum.net
cafehero123@gmail.com