Advertisement
tetris555

wedding-seats

Nov 14th, 2022
658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.48 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace TypeCasting
  5. {
  6.     internal class Program
  7.     {
  8.     static void Main(string[] args)
  9.         {
  10.             Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
  11.             string letterLastSector = Console.ReadLine();
  12.             char ch = letterLastSector.ToCharArray()[0];
  13.             int countRowsFirstSector = int.Parse(Console.ReadLine());
  14.             int seatsCountOnOddRow = int.Parse(Console.ReadLine());
  15.             int totalSeatsCount = 0;
  16.             int x = 1;
  17.  
  18.             for (int i = 'A'; i <= ch; i++)
  19.             {
  20.                 for (int j = 1; j < countRowsFirstSector + x; j++) // rows
  21.                 {
  22.                     if (j % 2 == 1)
  23.                     {
  24.                         for (int k = 'a' ; k < 'a' + seatsCountOnOddRow; k++)
  25.                         {
  26.                             Console.WriteLine($"{(char)i}{j}{(char)k}");
  27.                             totalSeatsCount++;
  28.                         }
  29.                     }
  30.                     else
  31.                     {
  32.                         for (int k = 'a'; k < 'a' + seatsCountOnOddRow + 2; k++)
  33.                         {
  34.                             Console.WriteLine($"{(char)i}{j}{(char)k}");
  35.                             totalSeatsCount++;
  36.                         }
  37.                     }
  38.                 }
  39.                 x++;
  40.             }
  41.             Console.WriteLine(totalSeatsCount);
  42.         }
  43.     }
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement