You are on page 1of 2

import java.util.

Scanner;
import java.util.Arrays;
class Problem2
{
public static void main(String args[])
{
int[] e=new int[500];
int a=1;
System.out.println("no. of test cases");
Scanner sc=new Scanner(System.in);
int number=sc.nextInt();
do{
System.out.println("total number of zombies (N).\t maximum time allowed (T).");
System.out.println("the energy of zombies (E)");
System.out.println("The initial energy level a player (P)\t.the minimum energy r
equired to advance (D)");
System.out.println("\n\n\n");
System.out.print(a);
System.out.println();
int n=sc.nextInt();
System.out.print(" ");
int t=sc.nextInt();
System.out.println();
boolean value=true;
for(int i=0;i<n;i++)
{
e[i]=sc.nextInt();
System.out.print(" ");
}
Arrays.sort(e);
System.out.println();
int p=sc.nextInt();
System.out.println(" ");
int d=sc.nextInt();
int count=0;
if(n<=t)
{
for(int i=0;i<n;i++)
{
if(e[i]<p)
{
p+=p-e[i];
}
else
value=false;
break;
}
}
else
{
value=false;
}
if(p>=d&&value==true)
{
value=true;
System.out.println("Yes");
}
else
{
System.out.println("No");
}
number--;
a++;
}while(number>0);
}
}

You might also like