galinyotsev123

ProgBasicsExam28and29July2018-E06substitute

Jan 11th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class E06substitute {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int K = Integer.parseInt(scanner.nextLine());
  8. int L = Integer.parseInt(scanner.nextLine());
  9. int M = Integer.parseInt(scanner.nextLine());
  10. int N = Integer.parseInt(scanner.nextLine());
  11.  
  12. int substitute = 0;
  13.  
  14. for (int i = K; i <= 8; i++) {
  15. for (int j = 9; j >= L; j--) {
  16. for (int o = M; o <= 8; o++) {
  17. for (int p = 9; p >= N; p--) {
  18. if (i % 2 != 0 || o % 2 != 0 || j % 2 == 0 || p % 2 == 0) {
  19. continue;
  20. } else if (i == o && j == p){
  21. System.out.println("Cannot change the same player.");
  22. } else {
  23. substitute++;
  24. System.out.println("" + i + j + " - " + o + p);
  25. }
  26.  
  27. if (substitute >= 6){
  28. return;
  29. }
  30. }
  31. }
  32. }
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment