Advertisement
yovkovbpfps

EXAM 28-29 JULY 2018 06.Subtitute

May 7th, 2019
104
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 substituteProblem_6 {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. int k =Integer.parseInt(scanner.nextLine());
  7. int l =Integer.parseInt(scanner.nextLine());
  8. int m =Integer.parseInt(scanner.nextLine());
  9. int n =Integer.parseInt(scanner.nextLine());
  10.  
  11. int possibleChanesConter=0;
  12.  
  13. for (int q=k;q<=8;q++){
  14. for (int j=9;j>=l;j--){
  15. for (int p=m;p<=8;p++){
  16. for (int z=9;z>=n;z--){
  17. if (q % 2 ==0 && j % 2 ==1 && p%2==0 && z%2==1){
  18. if (possibleChanesConter==6){
  19. break;
  20. }
  21. if (q==p && j==z){
  22. System.out.println("Cannot change the same player.");
  23. }else{
  24. possibleChanesConter++;
  25. System.out.printf("%s%s - %s%s%n",q,j,p,z);
  26. }
  27.  
  28. }
  29. }
  30. }
  31.  
  32. }
  33. }
  34.  
  35.  
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement