Advertisement
kzborisov

Ticket Combination

Sep 29th, 2018
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 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 Ticket_Combination
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. var counter = 0;
  15.  
  16. if (n >= 1 && n <= 10000)
  17. {
  18. for (char stadium = 'B'; stadium <= 76; stadium++)
  19. {
  20. for (var sector = 'f'; sector >= 97; sector--)
  21. {
  22. for (var entrance = 'A'; entrance <= 67; entrance++)
  23. {
  24. for (int row = 1; row <= 10 ; row++)
  25. {
  26. for (int seat = 10; seat >= 1; seat--)
  27. {
  28. if (stadium % 2 == 0)
  29. {
  30. string combination = stadium.ToString() + sector.ToString() +
  31. entrance.ToString() + row.ToString() + seat.ToString();
  32. int prize = stadium + sector + entrance + row + seat;
  33. counter++;
  34. if (n == counter)
  35. {
  36. Console.WriteLine($"Ticket combination: {combination}");
  37. Console.WriteLine($"Prize: {prize} lv.");
  38. }
  39. }
  40. else
  41. break;
  42. }
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement