311190: CF1948A. Special Characters

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Special Characterstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are given an integer $n$.

Your task is to build a string of uppercase Latin letters. There must be exactly $n$ special characters in this string. Let's call a character special if it is equal to exactly one of its neighbors.

For example, there are $6$ special characters in the AAABAACC string (at positions: $1$, $3$, $5$, $6$, $7$ and $8$).

Print any suitable string or report that there is no such string.

Input

The first line contains a single integer $t$ ($1 \le t \le 50$) — the number of test cases.

The only line of each test case contains a single integer $n$ ($1 \le n \le 50$).

Output

For each test case, print the answer as follows:

  • if there is no suitable string, print one line containing the string NO;
  • otherwise, print two lines. The first line should contain the string YES; on the second line print a string of length at most $200$ — the answer itself (it can be shown that if some answers exist, then there is an answer of length at most $200$). If there are several solutions, print any of them.
ExampleInput
3
6
1
2
Output
YES
AAABAACC
NO
YES
MM

Output

题目大意:
给定一个整数n,构造一个只包含大写拉丁字母的字符串,要求该字符串中恰好有n个特殊字符。定义一个字符是特殊的,如果它恰好等于它的一个相邻字符。例如,字符串"AAABAACC"中有6个特殊字符(位置:1, 3, 5, 6, 7, 8)。输出任意一个满足条件的字符串,或者报告没有这样的字符串。

输入输出数据格式:
输入:
第一行包含一个整数t(1≤t≤50),表示测试用例的数量。
每个测试用例只有一行,包含一个整数n(1≤n≤50)。

输出:
对于每个测试用例,按以下格式输出答案:
- 如果没有合适的字符串,则输出一行,内容为"NO";
- 否则,输出两行。第一行应包含字符串"YES",第二行输出一个长度最多为200的字符串——答案本身(可以证明,如果存在答案,那么就存在一个长度最多为200的答案)。如果有多个解决方案,输出其中任何一个。

示例输入输出:
输入:
```
3
6
1
2
```
输出:
```
YES
AAABAACC
NO
YES
MM
```题目大意: 给定一个整数n,构造一个只包含大写拉丁字母的字符串,要求该字符串中恰好有n个特殊字符。定义一个字符是特殊的,如果它恰好等于它的一个相邻字符。例如,字符串"AAABAACC"中有6个特殊字符(位置:1, 3, 5, 6, 7, 8)。输出任意一个满足条件的字符串,或者报告没有这样的字符串。 输入输出数据格式: 输入: 第一行包含一个整数t(1≤t≤50),表示测试用例的数量。 每个测试用例只有一行,包含一个整数n(1≤n≤50)。 输出: 对于每个测试用例,按以下格式输出答案: - 如果没有合适的字符串,则输出一行,内容为"NO"; - 否则,输出两行。第一行应包含字符串"YES",第二行输出一个长度最多为200的字符串——答案本身(可以证明,如果存在答案,那么就存在一个长度最多为200的答案)。如果有多个解决方案,输出其中任何一个。 示例输入输出: 输入: ``` 3 6 1 2 ``` 输出: ``` YES AAABAACC NO YES MM ```

加入题单

上一题 下一题 算法标签: