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 number = int.Parse(Console.ReadLine());
- string combination = string.Empty;
- int counter = 0;
- if (number >= 1 && number <= 10000)
- {
- for (int j = 66; j <= 76; j++)
- {
- for (int k = 102; k >= 97; k--)
- {
- for (int m = 65; m <= 67; m++)
- {
- for (int h = 1; h <= 10; h++)
- {
- for (int g = 10; g >= 1; g--)
- {
- char first = (char)(j);
- char second = (char)(k);
- char third = (char)(m);
- //combination = $"{first}{second}{third}{h}{g}";
- if (j % 2 == 0)
- {
- combination = $"{first}{second}{third}{h}{g}";
- int price = j + k + m + h + g;
- counter++;
- if (counter == number)
- {
- Console.WriteLine($"Ticket combination: {first}{second}{third}{h}{g}");
- Console.WriteLine($"Prize: {price} lv.");
- }
- }
- else
- {
- break;
- }
- }
- }
- }
- }
- }
- }
- else
- {
- Console.WriteLine("Input a valid number for the combination!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment