nikolayneykov

Untitled

Nov 3rd, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             char lastSector = char.Parse(Console.ReadLine());
  14.             int rowsCount = int.Parse(Console.ReadLine());
  15.             int oddRowCount = int.Parse(Console.ReadLine());
  16.             int totalPlaces = 0;
  17.             for (char i1 = 'A'; i1 <= lastSector; i1++, rowsCount++)
  18.             {
  19.                 for (int i2 = 1; i2 <= rowsCount; i2++)
  20.                 {
  21.                     int places = i2 % 2 == 1 ? oddRowCount : oddRowCount * 2;
  22.  
  23.                     for (char i3 = 'a'; i3 < 'a'+places; i3++)
  24.                     {
  25.                         Console.WriteLine($"{i1}{i2}{i3}");
  26.                         totalPlaces++;
  27.                     }
  28.                 }
  29.  
  30.             }
  31.             Console.WriteLine(totalPlaces);
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment