WindFell

Substitute Java

Sep 11th, 2018
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4.  
  5. public class Substitute {
  6.     public static void main(String[] args) throws IOException {
  7.         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  8.         int k = Integer.parseInt(reader.readLine());
  9.         int l = Integer.parseInt(reader.readLine());
  10.         int m = Integer.parseInt(reader.readLine());
  11.         int n = Integer.parseInt(reader.readLine());
  12.  
  13.         int substitute = 0;
  14.  
  15.         for (int i = k; i <= 8; i++) {
  16.             for (int j = 9; j >= l; j--) {
  17.                 for (int o = m; o <= 8; o++) {
  18.                     for (int p = 9; p >= n; p--) {
  19.                         if (i % 2 != 0 || o % 2 != 0 || j % 2 == 0 || p % 2 == 0) {
  20.                             continue;
  21.                         } else if (i == o && j == p){
  22.                             System.out.println("Cannot change the same player.");
  23.                         } else {
  24.                             substitute++;
  25.                             System.out.println("" + i + j + " - " + o + p);
  26.                         }
  27.  
  28.                         if (substitute >= 6){
  29.                             return;
  30.                         }
  31.                     }
  32.                 }
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment