Advertisement
tchenkov

L07u15_StupidPasswordGenerator

Feb 21st, 2017
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.13 KB | None | 0 0
  1. package Uprajneniq;
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6.  * Created by todor on 21.02.2017 г..
  7.  */
  8. public class u15_StupidPasswordGenerator { // SPG??
  9.     public static void main(String[] args) {
  10.         Scanner scan = new Scanner(System.in);
  11.         int n = Integer.parseInt(scan.nextLine());
  12.         int l = Integer.parseInt(scan.nextLine());
  13.        
  14.         for (int firstNum = 1; firstNum <= n; firstNum++) {
  15.             for (int secondNum = 1; secondNum <= n; secondNum++) {
  16.                 for (char firstLetter = 'a'; firstLetter < 'a' + l; firstLetter++) {
  17.                     for (char secondLetter = 'a'; secondLetter < 'a' + l; secondLetter++) {
  18.                         for (int lastNum = Math.max(firstNum, secondNum) + 1; lastNum <= n; lastNum++) {
  19.                             if (lastNum > n){
  20.                                 return;
  21.                             }
  22.                             System.out.printf("%d%d%s%s%d ", firstNum, secondNum, firstLetter, secondLetter, lastNum);
  23.                         }
  24.                     }                    
  25.                 }
  26.             }            
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement