Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- public class _Problem01 {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int number = sc.nextInt();
- sc.nextLine();
- String[] input = sc.nextLine().split(" ");
- int stuckCount = 0;
- for (int i = 0; i < input.length; i++) {
- for (int j = 0; j < input.length; j++) {
- if (j == i) {
- continue;
- }else {
- for (int j2 = 0; j2 < input.length; j2++) {
- for (int k = 0; k < input.length; k++) {
- if (j2 != i && j2 != j && k != i && k!= j && k != j2) {
- if ((input[i] + input[j]).equals(input[j2] + input[k])) {
- System.out.printf("%1$s|%2$s==%3$s|%4$s", input[i], input[j],
- input[j2], input[k]);
- System.out.println();
- stuckCount++;
- }
- }
- }
- }
- }
- }
- }
- if (stuckCount == 0) {
- System.out.println("No");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement