Simple Palindrome

Simple Palindrome

题目描述

Narek has to spend 2 hours with some 2-year-old kids at the kindergarten. He wants to teach them competitive programming, and their first lesson is about palindromes.

Narek found out that the kids only know the vowels of the English alphabet (the letters a \mathtt{a} a , e \mathtt{e} e , i \mathtt{i} i , o \mathtt{o} o , and u \mathtt{u} u ), so Narek needs to make a string that consists of vowels only. After making the string, he’ll ask the kids to count the number of subsequences that are palindromes. Narek wants to keep it simple, so he’s looking for a string such that the amount of palindrome subsequences is minimal.

Help Narek find a string of length $ n $ , consisting of lowercase English vowels only (letters a \mathtt{a} a , e \mathtt{e} e , i \mathtt{i} i , o \mathtt{o} o , and u \mathtt{u} u ), which minimizes the amount of palindrome † ^{\dagger} subsequences ‡ ^{\ddagger} in it.

† ^{\dagger} A string is called a palindrome if it reads the same from left to right and from right to left.

‡ ^{\ddagger} String t t t is a subsequence of string s s s if t t t can be obtained from s s s by removing several (possibly, zero or all) characters from s s s and concatenating the remaining ones, without changing their order. For example, o d o c s \mathtt{odocs} odocs is a subsequence of c od ef o r c e s \texttt{c}{\color{red}{\texttt{od}}}\texttt{ef}{\color{red}{\texttt{o}}}\texttt{r}{\color{red}{\texttt{c}}}\texttt{e}{\color{red}{\texttt{s}}} codeforces .

输入格式

The first line of the input contains a single integer t t t ( 1 ≤ t ≤ 100 1\le t \le 100 1t100) — the number of test cases. Subsequently, the description of each test case follows.

The only line of each test case contains a single integer n n n ( 1 ≤ n ≤ 100 1 \le n \le 100 1n100 ) — the size of the string.

输出格式

For each test case, output any string of length n n n that satisfies the above conditions.

样例 #1

样例输入 #1

3
2
3
6

样例输出 #1

uo
iae
oeiiua

提示说明

In the first example, uo \texttt{uo} uo has only three palindrome subsequences: u \texttt{u} u , o \texttt{o} o , and the empty string. It can be shown that there is no better answer.

In the third example, oeiiua \texttt{oeiiua} oeiiua has only eight palindrome subsequences: o \texttt{o} o , e \texttt{e} e , i \texttt{i} i , i \texttt{i} i , u \texttt{u} u , a \texttt{a} a , ii \texttt{ii} ii , and the empty string. It can be shown that there is no better answer.

代码内容

// #include <iostream>
// #include <algorithm>
// #include <cstring>
// #include <stack>//栈
// #include <deque>//队列
// #include <queue>//堆/优先队列
// #include <map>//映射
// #include <unordered_map>//哈希表
// #include <vector>//容器,存数组的数,表数组的长度
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
string s="aeiou";

void solve()
{
    ll n;
    cin>>n;

    ll x=n/5,y=n%5;
    for(ll i=0;i<5;i++)
    {
        if(y) cout<<s[i],y--;
        for(ll j=0;j<x;j++)
            cout<<s[i];
    }
    cout<<endl;
}

int main()
{
    ll t;
    cin>>t;

    while(t--) solve();

    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Pretty Boy Fox

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值