TEMA
30% alguém sabe me dizer onde esta o erro?
rsribeiro0 preguntado 6 years ago
import java.io.IOException; import java.util.Scanner;
public class Main { public static void main(String[] args) { Scanner ler = new Scanner(System.in);
int alt = ler.nextInt();
int n = ler.nextInt();
int pulo[] = new int[n];
boolean cond = true;
for (int i = 0; i < pulo.length; i++) {
pulo[i] = ler.nextInt();
if(i == 0) {
cond = true;
}
else if(pulo[i] - pulo[i - 1] > alt){
cond = false;
}
}
if(cond == true) {
System.out.println("YOU WIN");
}
else {
System.out.println("GAME OVER");
}
}
}