Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _07_SafePasswordsGenerator
- {
- class Program
- {
- static void Main(string[] args)
- {
- int a = int.Parse(Console.ReadLine());
- int b = int.Parse(Console.ReadLine());
- int maxPasswordsCount = int.Parse(Console.ReadLine());
- int combinationsCounter = 0;
- bool hasReachedTheLimit = false;
- for (char symbolA = (char)35; symbolA < 56; symbolA++)
- {
- for (char symbolB = (char)64; symbolB < 97; symbolB++)
- {
- for (int numberX = 1; numberX <= a; numberX++)
- {
- for (int numberY = 1; numberY <= b; numberY++)
- {
- Console.Write($"{(char)symbolA}{(char)symbolB}{numberX}{numberY}{(char)symbolB}{(char)symbolA}|");
- symbolA++;
- symbolB++;
- combinationsCounter++;
- if (combinationsCounter >= maxPasswordsCount)
- {
- hasReachedTheLimit = true;
- break;
- }
- if (numberY == b && numberX == a)
- {
- hasReachedTheLimit = true;
- break;
- }
- }
- if (hasReachedTheLimit)
- {
- break;
- }
- if (symbolA > 56)
- {
- symbolA = (char)35;
- }
- if (symbolB > 97)
- {
- symbolB = (char)64;
- }
- }
- if (hasReachedTheLimit)
- {
- break;
- }
- }
- if (hasReachedTheLimit)
- {
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment