-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathShopping_Game.java
44 lines (40 loc) · 1.08 KB
/
Shopping_Game.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
import java.util.Scanner;
public class Shopping_Game {
public static void main(String args[]) {
Scanner s=new Scanner(System.in);
int k=s.nextInt();
while(k>0)
{
int ans=0,h=0,i=1,t=0;
int m=s.nextInt();
int n=s.nextInt();
while(true)
{
int j=i+1;
ans+=i;
h+=j;
if(ans>m)
{
t=1;
break;
}
if(h>n)
{
t=0;
break;
}
i+=2;
j++;
}
k--;
if(t==1)
{
System.out.println("Harshit");
}
else
{
System.out.println("Aayush");
}
}
}
}