IvaAnd

MovieTickets

Mar 27th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class MovieTickets {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int a1 = Integer.parseInt(scanner.nextLine());
  8. int a2 = Integer.parseInt(scanner.nextLine());
  9. int n = Integer.parseInt(scanner.nextLine());
  10. int one = 0;
  11. int two = 0;
  12. int three = 0;
  13.  
  14. for (int i = a1 + 1; i <= a2; i++) {
  15. one = i - 1;
  16.  
  17. for (int j = 1; j <= n; j++) {
  18. two = j - 1;
  19.  
  20. for (int k = 4; k <= n; k++) {
  21. three = k / 2 - 1;
  22.  
  23. if (one % 2 == 1 && two >0 && three >0) {
  24.  
  25. if ((two + three + one) % 2 == 1) {
  26. System.out.printf("%c-%d%d%d%n", one, two, three, one);
  27.  
  28. }
  29. }
  30. }
  31.  
  32. }
  33. }
  34.  
  35. }
  36. }
Add Comment
Please, Sign In to add comment