TOPIC
time limit
Alan114 asked 3 years ago
Scanner sc = new Scanner(System.in);
List<String> list = new ArrayList<>();
int nivel = 0;
while (sc.hasNext()) {
list.addAll(Arrays.asList(sc.nextLine().split(" ")));
int x = list.size();
int[] vet = new int[x];
for (int i = 0; i < x; i++) {
vet[i] = Integer.parseInt(list.get(i));
}
for (int i = 0; i < x; i++) {
if (vet[i] >= 10 && vet[i] < 20) {
nivel = 2;
}
if (vet[i] > 20 || vet[i] == 20) {
nivel = 3;
break;
}
}
if (nivel == 0) {
nivel = 1;
}
System.out.println(nivel);
}
}
}
This topic has not been answered yet. Be the first!