题目链接: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. 【Java架构:基础技术】一篇文章搞掂:Spring Tool Suite(STS)

    1.简介 STS,是一个自定义版本的Eclipse,她可以方便地用来与各种Spring项目进行交互协作,建议采用Spring进行开发的时候,可以尝试使用这个IDE 2.下载与安装 登录https:// ...

  2. python 拆分字符串(3.0)

    拆分字符串 1. def my_split(s, ds): l = [s] for d in ds: res = [] list(map(lambda x: res.extend(x.split(d) ...

  3. js检查判断设备

    js检查判断设备 var navigatorType = {}; var u=navigator.userAgent; navigatorType.IsIE= u.indexOf('Trident') ...

  4. python random生成随机手机号

    上代码 #--------------- #!/usr/bin/python #_*_coding:UTF-8_*_ import random #生成随机手机号 str_start=random.c ...

  5. 209. Minimum Size Subarray Sum【滑动窗口】

    Given an array of n positive integers and a positive integer s, find the minimal length of a contigu ...

  6. Size Assert

    判断返回内容的大小

  7. 2019-9-11-.NET-Standard

    title author date CreateTime categories .NET Standard lindexi 2019-9-11 9:0:29 +0800 2019-9-11 9:0:2 ...

  8. C# 简单的统计指定几个字符组合的所有结果

    比如 用 a,b,c,d 4个字符组成一个8个长度的字符串,问一共有多少可能,应该有4的8次方种,用代码简单实现 private string[] AAA() { string[] cs = { &q ...

  9. JAVAWEB之文件的上传和下载

    一.文件的上传: Enctype的属性介绍: 基于表单文件上传的界面简介: 文件上传时服务器端获取不到请求信息的原因及获取请求信息的几种方式: 输入流方式的实现: 实用工具包的实现:要导入fileup ...

  10. jeecg问题汇总

    (1)使用代码生成器后记得修改spring扫描配置路径entity,dao,control control在jeecg\src\main\resources\spring-mvc.xml中配置 ent ...