desislava_topuzakova

06. Building

Feb 14th, 2022
795
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     int floors, apartments;
  9.     cin >> floors >> apartments;
  10.  
  11.     for (int floor = floors; floor > 0; floor--) {
  12.         for (int apartment = 0; apartment < apartments; apartment++) {
  13.             if (floor == floors) {
  14.                 cout << "L" << floor << apartment << " ";
  15.             } else if (floor % 2 == 0) {
  16.                 cout << "O" << floor << apartment << " ";
  17.             } else {
  18.                 cout << "A" << floor << apartment << " ";
  19.             }
  20.            
  21.         }
  22.         cout << endl;
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment