-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cat_Mouse.java
53 lines (46 loc) · 1.49 KB
/
Cat_Mouse.java
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
42
43
44
45
46
47
48
49
50
51
52
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Cat_Mouse {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int q = in.nextInt();
int positionOfX = 0;
int positionOfY = 0;
int positionOfZ = 0;
int[] distanceFromXtoZ = new int[q];
int[] distanceFromYtoZ = new int[q];
for(int a0 = 0; a0 < q; a0++){
int x = in.nextInt();
int y = in.nextInt();
int z = in.nextInt();
distanceFromXtoZ[a0] = Math.abs(z - x);
distanceFromYtoZ[a0] = Math.abs(z - y);
if(distanceFromXtoZ[a0] < distanceFromYtoZ[a0])
{
System.out.println("Cat A");
}
else if(distanceFromXtoZ[a0] > distanceFromYtoZ[a0])
{
System.out.println("Cat B");
}
else if(distanceFromXtoZ[a0] == distanceFromYtoZ[a0])
{
System.out.println("Mouse C");
}
}
//System.out.print("distanceFromXtoZ: ");
//System.out.print(Arrays.toString(distanceFromXtoZ));
System.out.println(" ");
System.out.print("distanceFromYtoZ: ");
System.out.print(Arrays.toString(distanceFromYtoZ));
/* check the position of z
* distance between x and z
* distance between y and z
*
*
*/
}
}