#K11571. Secure Password Generator
Secure Password Generator
Secure Password Generator
You are given an integer T representing the number of test cases. For each test case, you are given an integer N which is the length of the password to generate. Your task is to generate a secure password of exactly \(N\) characters that meets the following criteria:
- It contains at least one uppercase English letter.
- It contains at least one lowercase English letter.
- It contains at least one digit.
- It contains at least one special character from the set:
!@#$%^&*()-+
. - The length of the password is exactly \(N\) characters.
If \(N < 4\), it is impossible to satisfy all the conditions and you should output an error (or in our case, raise an exception/error).
The program should read from standard input and output the generated passwords to standard output – one password per line. Since password generation involves randomness, any output that meets the criteria is considered valid.
inputFormat
The first line contains a single integer \(T\) indicating the number of test cases. Each of the next \(T\) lines contains a single integer \(N\) which is the desired length of the password to be generated.
Input Format: T N1 N2 ... NT
outputFormat
For each test case, output a single line containing a secure password of length \(N\) that satisfies all the requirements.
Output Format: password1 password2 ... passwordT## sample
1
8
Ab3!CdE1