nikolayneykov

Untitled

Nov 5th, 2018
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         char lastSectorSymbol = char.Parse(Console.ReadLine());
  8.         int rowsCount = int.Parse(Console.ReadLine());
  9.         int oddRowPlacesCount = int.Parse(Console.ReadLine());
  10.         int totalPlacesCount = 0;
  11.  
  12.         for (char sector = 'A'; sector <= lastSectorSymbol; sector++, rowsCount++)
  13.         {
  14.             for (int row = 1; row <= rowsCount; row++)
  15.             {
  16.                 char places = row % 2 == 1 ?
  17.                     (char)('a' + oddRowPlacesCount) :
  18.                     (char)('a' + oddRowPlacesCount + 2);
  19.  
  20.                 for (char place = 'a'; place < places; place++, totalPlacesCount++)
  21.                 {
  22.                     Console.WriteLine($"{sector}{row}{place}");
  23.                 }
  24.             }
  25.         }
  26.         Console.WriteLine(totalPlacesCount);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment