Advertisement
ElviraPetkova

Danuci

Jan 25th, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 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 _01.Danuci
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int pinCod = int.Parse(Console.ReadLine());
  14.             int numberOfHash = int.Parse(Console.ReadLine());
  15.  
  16.             int secretCod = (500 + (pinCod % 1000)) / 10;
  17.  
  18.             int counterOfHash = 0;
  19.             int cod = 0;
  20.  
  21.             for (char a = 'a'; a <= 'z'; a++)
  22.             {
  23.                 for (char b = 'a'; b <= 'z'; b++)
  24.                 {
  25.                     for (int c = 0; c <= 9; c++)
  26.                     {
  27.                         for (char d = 'a'; d <= 'z'; d++)
  28.                         {
  29.                             cod = (a + b + c) - d;
  30.                             if (a != b && (cod == secretCod))
  31.                             {
  32.                                 Console.Write("{0}{1}{2}{3}", a, b, c, d);
  33.                                 counterOfHash++;
  34.  
  35.                                 if(counterOfHash == numberOfHash)
  36.                                 {
  37.                                     return;
  38.                                 }
  39.                             }
  40.                         }
  41.                     }
  42.                 }
  43.             }
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement