题目链接: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. Android中查看当前Activity是否销毁

    进入到Android-sdk中platform-tools目录 在命令行中执行以下命令 adb shell dumpsys activity>activity.txt 可以将当前的四大组件(Ac ...

  2. 最大流EK和Dinic算法

    最大流EK和Dinic算法 EK算法 最朴素的求最大流的算法. 做法:不停的寻找增广路,直到找不到为止 代码如下: @Frosero #include <cstdio> #include ...

  3. AcWing 203. 同余方程 (线性同余方程)打卡

    求关于x的同余方程 ax ≡ 1(mod b) 的最小正整数解. 输入格式输入只有一行,包含两个正整数a,b,用一个空格隔开. 输出格式输出只有一行,包含一个正整数x,表示最小正整数解. 输入数据保证 ...

  4. (转)OpenFire源码学习之十:连接管理(上)

    转:http://blog.csdn.net/huwenfeng_2011/article/details/43415827 关于连接管理分为上下两部分 连接管理 在大并发环境下,连接资源 需要随着用 ...

  5. web跨域问题解决方案

    在前端开发及调试过程中总能遇到浏览器报如下错误: Response to preflight request doesn't pass access control check: No 'Access ...

  6. 动态队列实现-----C语言

    /***************************************************** Author:Simon_Kly Version:0.1 Date: 20170520 D ...

  7. Java获取CPU占用率

    原文链接:https://www.jianshu.com/p/015cc4805e29 最近做一个Java性能统计的问题,需要统计当前进程占用CPU的情况,最开始使用Java MxBean来获取 Op ...

  8. 调用API接口,查询手机号码归属地(2)

    使用pymysql pip install pymysql 创建mysql测试表 CREATE TABLE `userinfo` ( `id` int(20) NOT NULL AUTO_INCREM ...

  9. 51-Ubuntu-打包压缩-1-打包压缩简介

    打包压缩是日常工作中备份文件的一种方式 在不同操作系统中,常用的打包压缩方式是不同的 Windows 常用 rar Mac 常用 zip Linux 常用 tar.gz

  10. 微信小程序支付之代码详解

    微信小程序自带的一套规则,类似vue语法,但是好多功能都集成在api中,给了很多初学者轮子,所以首先要熟悉这些api,忘记可照官网继续开发 这里主要说下微信小程序的支付,原理类似上篇介绍的公众网页支付 ...