B. All the Vowels Please

题目链接:https://codeforces.com/contest/1166/problem/B

B. All the Vowels Please

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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 nm=knm=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', '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.

 

思路:最最重要的,找出5*5的图表,之后就按顺序循环输出即可。

 

a

e

i

o

u

a

e

i

o

u

a

e

i

o

u

a

e

i

o

u

a

e

i

o

u

a

e

i

o

u

a

e

i

o

u

a

 

代码:

#include<iostream>

#include<algorithm>

#include<string>

#include<cmath>

using namespace std;

int main()

{

         int fla = 0;

         int m, n;

         int k;

         cin >> k;

         for (int i = 5; i <= sqrt(k); i++)

         {

                  if (k%i == 0)

                  {

                          m = i;

                          n = k / i;

                          fla = 1;

                          break;

                  }

         }

         if (fla == 0)cout << -1;

         else

         {

                  for (int i = 1; i <= m; i++)

                  {

                          if (i % 5 == 1)

                          {

                                   for (int j = 1; j <= n; j++)

                                   {

                                            if (j % 5 == 1)cout << "a";

                                            if (j % 5 == 2)cout << "e";

                                            if (j % 5 == 3)cout << "i";

                                            if (j % 5 == 4)cout << "o";

                                            if (j % 5 == 0)cout << "u";

                                   }

                          }

                          if (i % 5 == 2)

                          {

                                   for (int j = 1; j <= n; j++)

                                   {

                                            if (j % 5 == 1)cout << "e";

                                            if (j % 5 == 2)cout << "i";

                                            if (j % 5 == 3)cout << "o";

                                            if (j % 5 == 4)cout << "u";

                                            if (j % 5 == 0)cout << "a";

                                   }

                          }

                          if (i % 5 == 3)

                          {

                                   for (int j = 1; j <= n; j++)

                                   {

                                            if (j % 5 == 1)cout << "i";

                                            if (j % 5 == 2)cout << "o";

                                            if (j % 5 == 3)cout << "u";

                                            if (j % 5 == 4)cout << "a";

                                            if (j % 5 == 0)cout << "e";

                                   }

                          }

                          if (i % 5 == 4)

                          {

                                   for (int j = 1; j <= n; j++)

                                   {

                                            if (j % 5 == 1)cout << "o";

                                            if (j % 5 == 2)cout << "u";

                                            if (j % 5 == 3)cout << "a";

                                            if (j % 5 == 4)cout << "e";

                                            if (j % 5 == 0)cout << "i";

                                   }

                          }

                          if (i % 5 == 0)

                          {

                                   for (int j = 1; j <= n; j++)

                                   {

                                            if (j % 5 == 1)cout << "u";

                                            if (j % 5 == 2)cout << "a";

                                            if (j % 5 == 3)cout << "e";

                                            if (j % 5 == 4)cout << "i";

                                            if (j % 5 == 0)cout << "o";

                                   }

                          }

                  }

         }

}

 

全部评论

相关推荐

大方的大熊猫准备进厂:1.教育背景:你希望从事什么专业的工作你的主修课就是什么;成绩优秀是你应该做的,没什么可描述的,成绩不优秀也许人家在大学忙着创业呢?(成绩优秀不一定是好事,只能说明多元化的大学你上成了高中,没有真正上明白大学,反而体现了你死板,不爱社交,没有别的突出能力) 2.实践经历:你想表达的意思没有说清楚。你是说你会个性化服务,还是你有实习经历。如果没有带来,经济收益,表彰,更好的发展前景,那你还不如说说提升了自己哪些技能。你说有人给你送锦旗我都能明白你优秀,但是你说你会xxxx,你说这话谁信,证据呢。 3.入伍经历:你描述的就是你的工作职责或者你应该做的,并没有体现出来你把这个事情做好了,而且入伍经历并不能证明你能干好你要应聘的工作,不如只写经历其余所有内容都不写。 4.荣誉技能:重点突出一下,但不要过多描述,这些荣誉的含金量懂得都懂。 重点:你要应聘什么工作(具体岗位,实习生不具体),你的期望薪资
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务