Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Substitute {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int k = Integer.parseInt(scanner.nextLine());
- int l = Integer.parseInt(scanner.nextLine());
- int m = Integer.parseInt(scanner.nextLine());
- int n = Integer.parseInt(scanner.nextLine());
- int count = 0;
- for (int firstD1 = k; firstD1 <= 8; firstD1++) {
- if (firstD1 % 2 != 0) {
- continue;
- }
- for (int secondD1 = 9; secondD1 >= l; secondD1--) {
- if (secondD1 % 2 == 0) {
- continue;
- }
- for (int firstD2 = m; firstD2 <= 8; firstD2++) {
- if (firstD2 % 2 != 0) {
- continue;
- }
- for (int secondD2 = 9; secondD2 >= n; secondD2--) {
- if (secondD2 % 2 == 0) {
- continue;
- }
- String fistNumber = String.valueOf(firstD1) + String.valueOf(secondD1);
- String secondNumber = String.valueOf(firstD2) + String.valueOf(secondD2);
- if (fistNumber.equals(secondNumber)) {
- System.out.println("Cannot change the same player.");
- } else {
- System.out.printf("%s - %s\n", fistNumber, secondNumber);
- count++;
- if (count == 6) {
- return;
- }
- }
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment