Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.50 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___Ticket_Combination
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int numberComibation = int.Parse(Console.ReadLine());
  14.             int countCombinations = 0;
  15.  
  16.             for (char stadium = 'B'; stadium <= 'L'; stadium ++)
  17.             {
  18.                 if(stadium %2 !=0)
  19.                 {
  20.                     continue;
  21.  
  22.                 }
  23.  
  24.                 for (char sector = 'f'; sector >= 'a'; sector --)
  25.                 {
  26.                     for (char entrance = 'A';entrance  <= 'C';entrance ++)
  27.                     {
  28.                         for (int row= 1; row <=10; row++)
  29.                         {
  30.                             for (int seat = 10; seat >= 1; seat--)
  31.                             {
  32.                                 countCombinations++;
  33.                                 if (countCombinations==numberComibation)
  34.                                 {
  35.                                     Console.WriteLine($"Ticket combination: {stadium}{sector}{entrance}{row}{seat}");
  36.  
  37.                                     int sum = stadium + sector + entrance + row + seat;
  38.                                     Console.WriteLine($"Prize: {sum} lv.");
  39.                                 }
  40.                             }
  41.                         }
  42.                     }
  43.                 }
  44.             }
  45.  
  46.  
  47.  
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement