myrdok123

Untitled

Feb 20th, 2023
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1.  
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Demo {
  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.  
  14.  
  15. int countShift = 0;
  16.  
  17.  
  18. for (int k = K; k <= 8; k++) {
  19. if (k % 2 != 0) {
  20. continue;
  21. }
  22. for (int l = 9; l >= L; l--) {
  23. if (l % 2 == 0) {
  24. continue;
  25. }
  26. for (int m = M; m <= 8; m++) {
  27. if (m % 2 != 0) {
  28. continue;
  29. }
  30. for (int n = 9; n >= N; n--) {
  31.  
  32. if (countShift == 6){
  33. break;
  34. }
  35.  
  36. if (n % 2 == 0) {
  37. continue;
  38. }
  39.  
  40. if (k == m && l == n) {
  41. System.out.println("Cannot change the same player.");
  42.  
  43. }else {
  44. countShift++;
  45. System.out.printf("%d%d - %d%d%n", k, l, m, n);
  46. }
  47.  
  48.  
  49. }
  50. }
  51. }
  52. }
  53. }
  54. }
  55.  
  56.  
  57.  
Advertisement
Add Comment
Please, Sign In to add comment