Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Ticket_Combination
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- var counter = 0;
- if (n >= 1 && n <= 10000)
- {
- for (char stadium = 'B'; stadium <= 76; stadium++)
- {
- for (var sector = 'f'; sector >= 97; sector--)
- {
- for (var entrance = 'A'; entrance <= 67; entrance++)
- {
- for (int row = 1; row <= 10 ; row++)
- {
- for (int seat = 10; seat >= 1; seat--)
- {
- if (stadium % 2 == 0)
- {
- string combination = stadium.ToString() + sector.ToString() +
- entrance.ToString() + row.ToString() + seat.ToString();
- int prize = stadium + sector + entrance + row + seat;
- counter++;
- if (n == counter)
- {
- Console.WriteLine($"Ticket combination: {combination}");
- Console.WriteLine($"Prize: {prize} lv.");
- }
- }
- else
- break;
- }
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement