Cat and mouse

Subject:
Insert picture description here
Insert picture description here
Code:

#!/bin/python3

import math
import os
import random
import re
import sys

# Complete the catAndMouse function below.
def catAndMouse(x, y, z):
    if abs(z-x) < abs(z-y):
        return 'Cat A' 
    if abs(z-x) > abs(z-y):
        return ('Cat B')
    if abs(z-x) == abs(z-y):
        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()

If you think it's good, just like and follow the message~
Thank you for joining us~

Guess you like

Origin blog.csdn.net/BSCHN123/article/details/113592094