题目链接:http://codeforces.com/problemset/problem/1166/B


题意:问你是否存在一个长度为 k 的字符串,使得你将他们平铺成一个矩形之后,每行每列都包含 5 个元音。

思路:先判断能否弄出至少5*5的行列,然后按顺序填字符串就好了。

AC代码:

 #include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main()
{
int k,m,n;
string a = "aeiou";
cin >> k;
for( n = ;n * n <= k && k % n != ;n++);
m = k / n;
if(k % n || m < ) cout << "-1" << endl;
else
{
for(int i = ;i < k;i++)
cout << a[(i % m + i /m)%];
}
return ;
}

Codeforces 1166B - All the Vowels Please的更多相关文章

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

    链接:https://codeforces.com/contest/1166/problem/B 题意: Tom loves vowels, and he likes long words with ...

  2. Codeforces Round #434 (Div. 2, based on Technocup 2018 Elimination Round 1)&&Codeforces 861C Did you mean...【字符串枚举,暴力】

    C. Did you mean... time limit per test:1 second memory limit per test:256 megabytes input:standard i ...

  3. Codeforces Round #289 (Div. 2, ACM ICPC Rules) E. Pretty Song 算贡献+前缀和

    E. Pretty Song time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  4. Codeforces Round #566 (Div. 2) C. Beautiful Lyrics

    链接: https://codeforces.com/contest/1182/problem/C 题意: You are given n words, each of which consists ...

  5. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  6. [LeetCode] Reverse Vowels of a String 翻转字符串中的元音字母

    Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Giv ...

  7. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  8. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  9. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

随机推荐

  1. NX二次开发-基于NX开发向导模板的NX对Excel读写操作(OLE方式(COM组件))

    在看这个博客前,请读者先去完整看完:NX二次开发-基于MFC界面的NX对Excel读写操作(OLE方式(COM组件))https://ufun-nxopen.blog.csdn.net/article ...

  2. PHP面试 PHP基础知识 八(会话控制)

    ---恢复内容开始--- PHP会话控制技术 首先了解一下为什么要使用会话控制技术? 本身web 与服务器的交互是通过HTTP协议来实现的,而HTTP协议又是无状态协议.就是说明HTTP协议没有一个內 ...

  3. 9、TestNG介绍与安装

    介绍 TestNG是一个受JUnit和NUnit启发的测试框架,但引入了一些新功能,使其更加强大和易于使用,例如: 注释. 在任意大的线程池中运行你的测试,这些线程池有各种可用的策略(所有方法在他们自 ...

  4. ISA虚拟化的条件

    ISA(Instruction Set Architecture) 指令集体系结构,是硬件与软件层之间的接口. 本地系统虚拟机 本地系统虚拟机,就是Bare-Metal虚拟机,直接运行在硬件上,在它上 ...

  5. 深入理解JAVA虚拟机原理之垃圾回收器机制(一)

    更多Android高级架构进阶视频学习请点击:https://space.bilibili.com/474380680 对于程序计数器.虚拟机栈.本地方法栈这三个部分而言,其生命周期与相关线程有关,随 ...

  6. 1-Navicat无法远程连接Ubuntu上的MySQL(已解决)

    转发自: https://jingyan.baidu.com/article/4d58d54156ff069dd4e9c085.html

  7. mybatis的实际应用

    简单基本的增删改查语句就不说了,直接从一对一,一对多的关系开始: association联合:联合元素用来处理“一对一”的关系; collection聚集:聚集元素用来处理“一对多”的关系; MyBa ...

  8. jp@gc - Stepping Thread Group (deprecated)

      并发6个用户,线程之前不等待,每隔3秒增加1个用户,间隔时间是2秒,然后并发数增加完成之后,运行60秒,运行完成后,每1秒钟停止2个用户

  9. 前端 css 补充内容

    给个菜鸟教程的css教程网址(全的狠!!!): https://www.runoob.com/css/css-tutorial.html 下面是几张css基础样式图:

  10. Spring入门(二)

    Spring IOC&DI 控制反转(inversion of control):控制什么?什么反转? 我们都知道,传统的程序中,如果A类需要使用B类对象,会在程序中直接创建B类对象实例,此时 ...