anizko

05. Building

Apr 17th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.54 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Building
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int floor = int.Parse(Console.ReadLine());
  10.             int room = int.Parse(Console.ReadLine());
  11.  
  12.             for (int i = floor; i >= 1; i--)
  13.             {
  14.                 for (int j = 0; j < room; j++)
  15.                 {
  16.                     if (i == floor)
  17.                     {
  18.  
  19.                         if (j == room-1)
  20.                         {
  21.                             Console.WriteLine($"L{i}{j} ");
  22.                         }
  23.                         else
  24.                         {
  25.                             Console.Write($"L{i}{j} ");
  26.                         }
  27.                     }
  28.                     else if (i % 2 == 0)
  29.                     {
  30.                         if (j == room-1)
  31.                         {
  32.                             Console.WriteLine($"O{i}{j} ");
  33.                         }
  34.                         else
  35.                         {
  36.                             Console.Write($"O{i}{j} ");
  37.                         }
  38.                     }
  39.                     else
  40.                     {
  41.                         if (j == room-1)
  42.                         {
  43.                             Console.WriteLine($"A{i}{j} ");
  44.                         }
  45.                         else
  46.                         {
  47.                             Console.Write($"A{i}{j} ");
  48.                         }
  49.                     }
  50.                    
  51.  
  52.         }
  53.     }
  54.  
  55.    
  56.  
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment