Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MovieTickets {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int a1 = Integer.parseInt(scanner.nextLine());
- int a2 = Integer.parseInt(scanner.nextLine());
- int n = Integer.parseInt(scanner.nextLine());
- int one = 0;
- int two = 0;
- int three = 0;
- for (int i = a1 + 1; i <= a2; i++) {
- one = i - 1;
- for (int j = 1; j <= n; j++) {
- two = j - 1;
- for (int k = 4; k <= n; k++) {
- three = k / 2 - 1;
- if (one % 2 == 1 && two >0 && three >0) {
- if ((two + three + one) % 2 == 1) {
- System.out.printf("%c-%d%d%d%n", one, two, three, one);
- }
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment