From e8a88249ccfc6bef84762baabac3679e29e6c10c Mon Sep 17 00:00:00 2001 From: Champion8952 <60774941+Champion8952@users.noreply.github.com> Date: Thu, 8 Oct 2020 23:46:09 +0530 Subject: [PATCH] Create-Hackerrank Cats and Mouse Hackerrank solution for Cats and Mouse --- Hackerrank-Cats and Mouse | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Hackerrank-Cats and Mouse diff --git a/Hackerrank-Cats and Mouse b/Hackerrank-Cats and Mouse new file mode 100644 index 0000000..22136d9 --- /dev/null +++ b/Hackerrank-Cats and Mouse @@ -0,0 +1,37 @@ +#!/bin/python3 + +import math +import os +import random +import re +import sys + +# Complete the catAndMouse function below. +def catAndMouse(x, y, z): + absCatA, absCatB = abs(x - z), abs(y - z) + if absCatA == absCatB : + return "Mouse C" + elif absCatB > absCatA : + return "Cat A" + else : + return "Cat B" + +if __name__ == '__main__': + fptr = open(os.environ['OUTPUT_PATH'], 'w') + + q = int(input()) + + for q_itr in range(q): + xyz = input().split() + + x = int(xyz[0]) + + y = int(xyz[1]) + + z = int(xyz[2]) + + result = catAndMouse(x, y, z) + + fptr.write(result + '\n') + + fptr.close()