-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblema1241.java
More file actions
38 lines (29 loc) · 981 Bytes
/
Copy pathproblema1241.java
File metadata and controls
38 lines (29 loc) · 981 Bytes
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
package beeCrowd;
import java.util.Scanner;
public class problema1241 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//Recebe numero de casos
System.out.println("Digite quantos testes: ");
int N = sc.nextInt();
sc.nextLine();
String[] testes = new String[N];
for (int i = 0; i < N ; i++) {
testes[i] = sc.nextLine();
}
for (int i = 0; i < N ; i++) {
String [] numeros = testes[i].split("\\s+");
//Testar se possui apenas digitos
if (numeros.length != 2|| !numeros[0].matches("[0-9]+") || !numeros[1].matches("[0-9]+")) {
break;
}
//Ver se encaixa ou não
if(numeros[0].endsWith(numeros[1])){
System.out.println("encaixa");
} else {
System.out.println("nao encaixa");
}
}
sc.close();
}
}