Hey guys! Super new to coding, and very new to codechef. I’ve been testing out some of the beginner challenges and I came upon From Heaven to Earth. I came up with the code that follows. It says my answer is wrong, but I’m not too sure what’s wrong with it. Could I get some help improving my code and hopefully move toward completing this problem? (Also, I apologize if this was formatted incorrectly (very new))
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter the amount of tests you want");
int t = input.nextInt();
while(t>0) {
if (t >= 1 || t <= 1000) {
t-=1;
System.out.println("Please enter 3 integers using a space or enter inbetween each one: ");
int n = input.nextInt();
if (n < 1 || n >= 100) {
System.out.println("Null");
break;
}
int v1 = input.nextInt();
if (v1 < 1 || v1 >= 100) {
System.out.println("Null");
break;
}
int v2 = input.nextInt();
if (v2 < 1 || v2 >= 100) {
System.out.println("Null");
break;
}
double t1 = (1.0*Math.sqrt(2)*n)/v1;
double t2 = (1.0*2*n)/v2;
if(t1 < t2){
System.out.println("Stairs");}
else {
System.out.println("Elevator");}
}
else { System.out.println("Null"); }
}}}