Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. char lastSector = Console.ReadLine().ToCharArray()[0];
  8. byte rowsInFirstSector = byte.Parse(Console.ReadLine());
  9. byte seatsOnUnevenRows = byte.Parse(Console.ReadLine());
  10.  
  11. int numberOfRowsInCurrentSector = rowsInFirstSector;
  12. int numberOfSeats = 0;
  13.  
  14. for (char currentSector = 'A'; currentSector<=lastSector; currentSector++)
  15. {
  16. for (int currentRow = 1; currentRow<=numberOfRowsInCurrentSector;currentRow++)
  17. {
  18. int lastSeat;
  19. if (currentRow%2==1) lastSeat = (int)'a'+seatsOnUnevenRows-1;
  20. else lastSeat = (int)'a'+seatsOnUnevenRows+1;
  21. for (char currentSeat = 'a'; (int)currentSeat<=lastSeat;)
  22. {
  23. Console.WriteLine("{0}{1}{2}",currentSector,currentRow,currentSeat);
  24. currentSeat = (char)((int)currentSeat+1);
  25. numberOfSeats++;
  26. }
  27. }
  28. numberOfRowsInCurrentSector++;
  29. }
  30. Console.WriteLine(numberOfSeats);
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement