-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode18.py
More file actions
41 lines (28 loc) · 735 Bytes
/
Copy pathcode18.py
File metadata and controls
41 lines (28 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#cat and mouse
#link : https://www.hackerrank.com/challenges/cats-and-a-mouse/problem
import math
import os
import random
import re
import sys
# Complete the catAndMouse function below.
def catAndMouse(x, y, z):
a=(((z-x)**2)**0.5)
b=(((z-y)**2)**0.5)
if a<b:
return "Cat A"
elif a>b:
return "Cat B"
else:
return "Mouse C"
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()