Advertisement
Spocoman

06. Wedding Seats

Sep 12th, 2023
792
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     char finalSector;
  7.     cin >> finalSector;
  8.  
  9.     int rows, oddSeats, totalSeats = 0;
  10.     cin >> rows >> oddSeats;
  11.  
  12.     for (char i = 'A'; i <= finalSector; i++) {
  13.         for (int k = 1; k <= rows; k++) {
  14.             int currentSeats = oddSeats;
  15.             if (k % 2 == 0) {
  16.                 currentSeats += 2;
  17.             }
  18.  
  19.             for (char o = 'a'; o < currentSeats + 97; o++) {
  20.                 cout << i << k << o << endl;
  21.                 totalSeats++;
  22.             }
  23.         }
  24.         rows++;
  25.     }
  26.     cout << totalSeats << endl;
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement