Ligh7_of_H3av3n

06. Substitute

Oct 15th, 2023
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.46 KB | None | 0 0
  1. package PodgotovkaZaIzpit;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Substitute {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int k = Integer.parseInt(scanner.nextLine());
  10.         int l = Integer.parseInt(scanner.nextLine());
  11.         int m = Integer.parseInt(scanner.nextLine());
  12.         int n = Integer.parseInt(scanner.nextLine());
  13.         int counter = 0;
  14.  
  15.         for (int i = k; i <= 8; i++)
  16.         {
  17.             if (i % 2 == 1) { continue; }
  18.             for (int o = 9; o >= l; o--)
  19.             {
  20.                 if (o % 2 == 0) { continue; }
  21.                 for (int p = m; p <= 8; p++)
  22.                 {
  23.                     if (p % 2 == 1) { continue; }
  24.                     for (int q = 9; q >= n; q--)
  25.                     {
  26.                         if (q % 2 == 0)
  27.                         {
  28.                             continue;
  29.                         }
  30.  
  31.                         if (i == p && o == q)
  32.                         {
  33.  
  34.                             System.out.println("Cannot change the same player.");
  35.  
  36.                         }
  37.                         else
  38.                         {
  39.                             counter++;
  40.                             System.out.printf("%d%d - %d%d\n",i, o, p, q );
  41.  
  42.  
  43.                         }
  44.                         if (counter == 6) {return; }
  45.  
  46.                     }
  47.  
  48.  
  49.  
  50.                 }
  51.             }
  52.         }
  53.     }
  54.  
  55.     }
  56.  
  57.  
Add Comment
Please, Sign In to add comment