题目链接: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. (转)OpenFire源码学习之十七:HTTP Service插件

    转:http://blog.csdn.net/huwenfeng_2011/article/details/43457645 HTTP Service插件 这里的http接口插件是神马? Openfi ...

  2. on() 不支持hover事件

    因为 .hover() 是 jQuery 自己定义的事件… 是为了方便用户绑定调用 mouseenter 和 mouseleave 事件而已,它并非一个真正的事件,所以当然不能当做 .bind() 中 ...

  3. 拾遗:vim 快捷键设置

    ~/.vimrc 零.批量注释与反注释 :sp / :vsp       横向 / 纵向拆分窗口 :e            打开新文件 zc:拆叠代码 / zo:展开代码 set foldmetho ...

  4. Javascript 面向对象之继承

    本文参考书籍<<Javascript高级程序设计>> js继承方式:实现继承,主要依靠原型链实现. 原型链:基本思想:利用原型让一个引用类型继承另一个引用类型的属性和方法. 这 ...

  5. SB般的“WE战队”输掉了比赛

    事实再一次证明,对于LOL这种游戏,国服选手是根本就不能有一点期待的, 国服环境太好了,赢了可以吹,输了不能骂,自信心极度膨胀,估计WE俱乐部都没有个心理咨询师, 下岗了还可以再卖卖脸,卖卖饼, 国服 ...

  6. Bash 脚本 set 命令教程

    http://www.ruanyifeng.com/blog/2017/11/bash-set.html set命令是 Bash 脚本的重要环节,却常常被忽视,导致脚本的安全性和可维护性出问题.本文介 ...

  7. final、finally和finalized的区别?

    (1)final:被final修饰的类,不被能继承:被final修饰的方法,不能被重写:被fianl修饰的量,为常量,只能被赋值一次: (2)finally:异常处理,和try.catch结合使用,可 ...

  8. 召回率、AUC、ROC模型评估指标精要

    混淆矩阵 精准率/查准率,presicion 预测为正的样本中实际为正的概率 召回率/查全率,recall 实际为正的样本中被预测为正的概率 TPR F1分数,同时考虑查准率和查全率,二者达到平衡,= ...

  9. java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoa

    最近运行ssm项目遇到tomcat启动报错: 解决办法,右击项目选择properties 在Deployment Assembly  add 选择maven dedependencies 项目成功运行 ...

  10. d3创建多个svg元素

    当然也可以创建dom var svg = d3.select('#svg'); svg .slectAll('circle.bb')     //选中DOM中的所有circle.bb标签,当DOM中不 ...