Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class WeddingSeats {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- char finalSector = scanner.nextLine().charAt(0);
- int rows = Integer.parseInt(scanner.nextLine()),
- oddSeats = Integer.parseInt(scanner.nextLine()),
- totalSeats = 0;
- for (char i = 'A'; i <= finalSector; i++) {
- for (int k = 1; k <= rows; k++) {
- int currentSeats = oddSeats;
- if (k % 2 == 0) {
- currentSeats += 2;
- }
- for (char o = 'a'; o < currentSeats + 97; o++) {
- System.out.printf("%c%d%c\n", i, k, o);
- totalSeats++;
- }
- }
- rows++;
- }
- System.out.println(totalSeats);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement