nikolayneykov

Untitled

Oct 30th, 2018
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 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 TicketCombination
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             int counter = 0;
  15.  
  16.             for (char a = 'B'; a <= 'L'; a++)
  17.             {
  18.                 for (char b = 'f'; b >= 'a'; b--)
  19.                 {
  20.                     for (char c = 'A'; c <= 'C'; c++)
  21.                     {
  22.                         for (int d = 1; d <= 10; d++)
  23.                         {
  24.                             for (int e = 10; e >= 1; e--)
  25.                             {
  26.                                 if (a % 2 == 0)
  27.                                 {
  28.                                     counter++;
  29.                                 }
  30.  
  31.                                 if (counter == n)
  32.                                 {
  33.                                     Console.WriteLine($"Ticket combination: {a}{b}{c}{d}{e}");
  34.                                     Console.WriteLine($"Prize: " + (a + b + c + d + e) + " lv.");
  35.                                     return;
  36.                                 }
  37.  
  38.                             }
  39.                         }
  40.                     }
  41.                 }
  42.  
  43.             }
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment