Advertisement
bodyquest

6-th problem

Nov 3rd, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 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 _6.Problem_Six
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. char lastSector = char.Parse(Console.ReadLine());
  14. int countFirstSector = int.Parse(Console.ReadLine());
  15. int countEvenSeats = int.Parse(Console.ReadLine());
  16. int count = 0;
  17. int countAllSeats = 0;
  18.  
  19. for (char sector = 'A'; sector <= lastSector; sector++)
  20. {
  21.  
  22. for (int row = 1; row <=countFirstSector+count; row++)
  23. {
  24. if (row %2 != 0)
  25. {
  26. for (char seats = 'a'; seats <= countEvenSeats; seats++)
  27. {
  28. Console.WriteLine($"{sector}{row}{seats}");
  29. countAllSeats++;
  30. }
  31. }
  32. else if (row % 2 ==0)
  33. {
  34. for (char seats = 'a'; seats <= countEvenSeats + 2; seats++)
  35. {
  36. Console.WriteLine($"{sector}{row}{seats}");
  37. countAllSeats++;
  38. }
  39. }
  40. }
  41. count++;
  42. }
  43. Console.WriteLine(countAllSeats);
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement