-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNUMCOMP.java
More file actions
38 lines (33 loc) · 951 Bytes
/
NUMCOMP.java
File metadata and controls
38 lines (33 loc) · 951 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
import java.util.Scanner;
public class NUMCOMP
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int t=scan.nextInt();
for(int t_=0;t_<t ; t_++)
{
int a =scan.nextInt();
int b=scan.nextInt();
int n=scan.nextInt();
if(n%2==1)
{
//odd
if(a>b)
System.out.println("1");
else if(a<b) System.out.println("2");
else System.out.println("0");
}
else
{
//even
double x=(double)a*(double)a;
double y=(double)b*(double)b;
if(x>y)
System.out.println("1");
else if(x<y) System.out.println("2");
else System.out.println("0");
}
}
}
}