1166B Codeforces Round #561 (Div. 2) B. All the Vowels Please

Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length k is vowelly if there are positive integers n and m such that n⋅m=k and when the word is written by using n rows and m columns (the first row is filled first, then the second and so on, with each row filled from left to right), every vowel of the English alphabet appears at least once in every row and every column.

You are given an integer k and you must either print a vowelly word of length k or print −1 if no such word exists.

In this problem the vowels of the English alphabet are ‘a’, ‘e’, ‘i’, ‘o’ ,‘u’.

Input

Input consists of a single line containing the integer k (1≤k≤104) — the required length.

Output

The output must consist of a single line, consisting of a vowelly word of length k consisting of lowercase English letters if it exists or −1 if it does not.

If there are multiple possible words, you may output any of them.

Examples

input

7

output

1

input

36

output

agoeuioaeiruuimaeoieauoweouoiaouimae

代码:

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<iomanip>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<sstream>
#define ll long long
#define mes(x,y) memset(x,y,sizeof(x))
using namespace std;
int cmp(int x){
	int flag=-1,i=5;
	for(;i<=sqrt(x);i++){
		if(x%i==0){
			flag=i;break;
		}
	}
	return flag;
}
int main(){
	int k,i,j,h,w;
	char ff[20][5];
	ff[0][0]='a';ff[0][1]='e';ff[0][2]='i';ff[0][3]='o';ff[0][4]='u';
	ff[1][0]='e';ff[1][1]='i';ff[1][2]='o';ff[1][3]='u';ff[1][4]='a';
	ff[2][0]='i';ff[2][1]='o';ff[2][2]='u';ff[2][3]='a';ff[2][4]='e';
	ff[3][0]='o';ff[3][1]='u';ff[3][2]='a';ff[3][3]='e';ff[3][4]='i';
	ff[4][0]='u';ff[4][1]='a';ff[4][2]='e';ff[4][3]='i';ff[4][4]='o';
	while(cin>>k){
		int c=cmp(k),flag=1;
		int v=k/c;
		if(c<5||v<5){
			cout<<"-1"<<endl;continue;
		}//不能被分成长和宽小于5
		
		for(i=0,w=0;i<v;i++,w++){
			if(w==5)w=0;
			for(j=0,h=0;j<c;j++,h++){
				if(h==5)h=0;
				cout<<ff[w][h];
			}
		} 
		cout<<endl;
	}
} 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

GUESSERR

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

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

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

打赏作者

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

抵扣说明:

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

余额充值