Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length ? is vowelly if there are positive integers ? and ? such that ?⋅?=? and when the word is written by using ? rows and ? 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 ? and you must either print a vowelly word of length ? 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 ? (1≤?≤104) — the required length.
Output
The output must consist of a single line, consisting of a vowelly word of length ? 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
inputCopy
7
outputCopy
-1
inputCopy
36
outputCopy
agoeuioaeiruuimaeoieauoweouoiaouimae
Note
In the second example, the word “agoeuioaeiruuimaeoieauoweouoiaouimae” can be arranged into the following 6×6 grid:
It is easy to verify that every row and every column contain all the vowels.
题目:https://codeforces.com/contest/1166/problem/B
题意:找出一个数k的公因子,分解k,根据公因子构造循环,直接输出aieou。
附上AC代码:
#include< iostream>
#include< cstdio>
#include< algorithm>
#define rep(i,a,b)for(int i=a;i<=b;i++)
using namespace std;
string s="aeiou";
int k,m,w;
int main(){
scanf("%d",&k);
int flag=0;
rep(i,1,k)
if(k%i==0&&i>=5&&k/i>=5){
flag=1;
w=k/i;
m=i;
break;
}
if(!flag)return puts("-1");
rep(i,0,m-1)
rep(j,0,w-1)
printf("%c",s[(i+j)%5]);
printf("\n");
return 0;
}