-
Notifications
You must be signed in to change notification settings - Fork 0
/
janmansh and jay
31 lines (29 loc) · 991 Bytes
/
janmansh and jay
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
Problem
Janmansh and Jay are playing a game. They start with a number X and they play a total of Y moves.
Janmansh plays the first move of the game, after which both the players make moves alternatingly.
In one move, a player can increment or decrement X by 1.
If the final number after performing
Y moves is even, then Janmansh wins otherwise, Jay wins. Determine the winner of the game if both the players play optimally.
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++){
int a=sc.nextInt();
int b=sc.nextInt();
if((a+b)%2==0){
System.out.println("janmansh");
}
else{
System.out.println("jay");
}
}// your code goes here
}
}