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