codeforces 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 kk is vowelly if there are positive integers nn and mm such that n?m=kn?m=k and when the word is written by using nn rows and mm 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 kk and you must either print a vowelly word of length kk or print ?1?1 if no such word exists.
In this problem the vowels of the English alphabet are ‘a(chǎn)’, ‘e’, ‘i’, ‘o’ ,‘u’.
Input
Input consists of a single line containing the integer kk (1≤k≤1041≤k≤104) — the required length.
Output
The output must consist of a single line, consisting of a vowelly word of length kk consisting of lowercase English letters if it exists or ?1?1 if it does not.
If there are multiple possible words, you may output any of them.
Examples
input
Copy
7
output
Copy
-1
input
Copy
36
output
Copy
agoeuioaeiruuimaeoieauoweouoiaouimae
Note
In the second example, the word “agoeuioaeiruuimaeoieauoweouoiaouimae” can be arranged into the following 6×66×6 grid:
It is easy to verify that every row and every column contain all the vowels.
題意:湯姆喜歡元音,他喜歡有很多元音的長單詞。他最喜歡的詞是元音詞。如果有正整數(shù)n和m,使得n m=k,我們稱長度為k的單詞為元音,當(dāng)用n行和m列(第一行先填,然后第二行等,每行從左到右填)書寫時,英語字母表中的每個元音在每行和每列中至少出現(xiàn)一次。
您將得到一個整數(shù)k,如果不存在這樣的單詞,則必須打印長度為k的元音單詞或打印?1。
在這個問題中,英語字母表中的元音是“a”、“e”、“i”、“o”、“u”。
題解:根據(jù)題意 n,m>=5,將符合條件的所有k篩選出來。
輸入的k如果符合條件就構(gòu)造單詞并輸出,否則輸出-1.
總結(jié)
以上是生活随笔為你收集整理的codeforces All the Vowels Please的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: gif一键抠图 在线_给视频抠图?这个在
- 下一篇: python将argv作为参数_在jup