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 ...
随机推荐
- delphi 下载
获取网络文件大小 //delphi 获取网络文件大小 function GetUrlFileSize(aURL: string): integer; var FileSize: integer; va ...
- 关于ACL访问控制的一些问题:AntiACL
@echo off title AntiACL Made By gwsbhqt color 0a reg query "HKU\S-1-5-19" >nul 2>nul ...
- error LNK2019: 无法解析的外部符号 "__declspec(dllimport) long __stdcall RtlGetVersion(struct _OSVERSIONINFOW
虽然ntdll.lib库也引用了,但还是提示找不到RtlGetVersion函数定义,工程中头文件的定义如下: NTSYSAPI NTSTATUS NTAPI RtlGetVersion( _ ...
- ASP.NET Core学习——1
ASP.NET Core介绍 ASP.NET Core是一个新的开源和跨平台的框架,用于构建如Web应用.物联网(IoT)应用和移动后端应用等连接到互联网的基于云的现代应用程序.ASP.NET Cor ...
- Socket通信1.0
Socket通信1.0 服务器端: package page; import java.io.BufferedReader; import java.io.IOException; import ja ...
- Invoking destroy method 'close' on bean with name 'dataSource'
Invoking destroy method 'close' on bean with name 'dataSource' Spring与Mybatis整合时出现的问题,找了一晚上结果是一个属性写错 ...
- Address already in use: JVM_Bind 8083端口被占用的几个解决办法
运行Tomcat时若出现Address already in use: JVM_Bind 端口被占用,一般使用下面几个办法可以解决: 假设端口为8083 1.启动cmd, 执行命令netstat -a ...
- GDI及Windows的消息机制
什么是GDI? GDI, Graphics Device Interface GDI在以下位置已经被微软列为Legacy Graphics,不建议使用来开发应用程序(http://msdn.micro ...
- 动态方法调用秘密武器 —— invokedynamic 指令解读 - MethodHandle
原文:https://juejin.im/book/5c25811a6fb9a049ec6b23ee/section/5ccc66dd518825403b5975fb import java.lang ...
- REST Client实际应用记录
请求Content-Type为application/x-www-form-urlencoded 先来看一个完整示例: ############## ### qa问答 @msg="糖尿病患者 ...