Codeforces 1166B - All the Vowels Please
题目链接: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的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- Codeforces Round #566 (Div. 2) C. Beautiful Lyrics
链接: https://codeforces.com/contest/1182/problem/C 题意: You are given n words, each of which consists ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- [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 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
随机推荐
- DUBBO+Zookeeper在Centos7中本地搭建及小案例
环境: 1.centos7 2.jdk-7u76-linux-x64.tar.gz 2.tomcat:apache-tomcat-7.0.59.tar.gz 3.zookeeper-3.4.6.tar ...
- js实现超简单sku组合算法
let arr = [ [1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], ]; function cartesianProductOf() { return ...
- Go语言基础:make,new, len, cap, append, delete方法
前面提到不少Go的内建函数,这篇文章学习下如何使用.. make 先拿 make 开刀,可是一开始我就进入了误区,因为我想先找到他的源码,先是发现 src/builtin/builtin.go 中 ...
- 冲上云霄,Dubbo Go!
来源:开源中国社区 5 月 21 日,经过一年多的孵化,Apache Dubbo 从 Apache 软件基金会毕业,成为 Apache 顶级项目.推荐:厉害了,Dubbo 正式毕业! Dubbo 是阿 ...
- 微信小程序开发之https服务器搭建三步曲
本篇文章主要讲述3个方面的内容,如下: 1.SSL证书的获取 2.服务器 Nginx SSL 证书的配置. 3.如何兼容80端口和443端口以及为什么要同时兼容这两个端口. 1.SSL证书的获取 ht ...
- angularJS select下拉框检测改变
html:(已引入amazeUI) <div style="width:70px;display:inline-block;"> <form class=&quo ...
- (Struts2学习系列三)Struts2动态方法调用:通配符方式
更改src/struts2.xml的代码: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE ...
- ubuntu系统设置密码报错 Module is unknown
修改账户密码报错 # passwd 报错信息 passwd: Module is unknown passwd: password unchanged 修改配置文件 # cd /etc/pam.d ...
- loop find column
declare l_sql varchar2(500); -- variable that contains a query l_c sys_refcursor; -- cursor variable ...
- UVA11427 Expect the Expected 概率dp+全概率公式
题目传送门 题意:小明每晚都玩游戏,每一盘赢的概率都是p,如果第一盘就赢了,那么就去睡觉,第二天继续玩:否则继续玩,玩到赢的比例大于p才去睡:如果一直玩了n盘还没完成,就再也不玩了:问他玩游戏天数的期 ...