Advertisement
elena_tasheva

Untitled

Nov 2nd, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. import javax.swing.plaf.IconUIResource;
  2. import java.util.Scanner;
  3.  
  4. public class Substitude {
  5.  
  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 count = 0;
  14. boolean finish = false;
  15.  
  16. for (int i = K; i <= 8; i++) {
  17. for (int j = 9; j >= L; j--) {
  18. for (int k = M; k <= 8; k++) {
  19. for (int l = 9; l >= N; l--) {
  20. if ((((i % 2 == 0 && k % 2 == 0)) && ((j % 2 == 1 && l % 2 == 1)))) {
  21. String num1 = "" + i + j;
  22. String num2 = "" + k + l;
  23. if (num1.equals(num2)) {
  24. System.out.println("Cannot change the same player.");
  25. } else {
  26. System.out.println(num1 + " " + "-" + " " + num2);
  27. count++;
  28. }
  29. }
  30. if (count == 6) {
  31. finish = true;
  32. break;
  33. }
  34. }
  35. if(finish){
  36. break;
  37. }
  38. }
  39. if(finish){
  40. break;
  41. }
  42.  
  43. }
  44. if(finish){
  45. break;
  46. }
  47. }
  48. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement