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";

                                   }

                          }

                  }

         }

}

 

全部评论

相关推荐

最近群里有很多同学找我看简历,问问题,主要就是集中在明年三月份的暑期,我暑期还能进大厂嘛?我接下来该怎么做?对于我来说,我对于双非找实习的一个暴论就是title永远大于业务,你在大厂随随便便做点慢SQL治理加个索引,可能就能影响几千人,在小厂你从零到一搭建的系统可能只有几十个人在使用,量级是不一样的。对双非来说,最难的就是约面,怎么才能被大厂约面试?首先这需要一点运气,另外你也需要好的实习带给你的背书。有很多双非的同学在一些外包小厂待了四五个月,这样的产出有什么用呢?工厂的可视化大屏业务很广泛?产出无疑是重要的,但是得当你的实习公司到了一定的档次之后,比如你想走后端,那么中厂后端和大厂测开的选择,你可以选择中厂后端(注意,这里的中厂也得是一些人都知道的,比如哈啰,得物,b站之类,不是说人数超过500就叫中厂),只有这个时候你再去好好关注你的产出,要不就无脑大厂就完了。很多双非同学的误区就在这里,找到一份实习之后,就认为自己达到了阶段性的任务,根本不再投递简历,也不再提升自己,玩了几个月之后,美其名曰沉淀产出,真正的好产出能有多少呢?而实际上双非同学的第一份实习大部分都是工厂外包和政府外包!根本无产出可写😡😡😡!到了最后才发现晚了,所以对双非同学来说,不要放过任何一个从小到中,从中到大的机会,你得先有好的平台与title之后再考虑你的产出!因为那样你才将将能过了HR初筛!我认识一个双非同学,从浪潮到海康,每一段都呆不久,因为他在不断的投递和提升自己,最后去了美团,这才是双非应该做的,而我相信大部分的双非同学,在找到浪潮的那一刻就再也不会看八股,写算法,也不会打开ssob了,这才是你跟别人的差距。
迷茫的大四🐶:我也这样认为,title永远第一,只有名气大,才有人愿意了解你的简历
双非本科求职如何逆袭
点赞 评论 收藏
分享
11-04 10:30
已编辑
门头沟学院 研发工程师
开心小狗🐶:“直接说答案”
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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