【codeforces 434 div 1 A】Did you mean...
【链接】h在这里写链接
【题意】
【题解】
【错的次数】
【反思】
【代码】
#include <bits/stdc++.h>
using namespace std; const int N = 3e3; int n;
int a[N+10],is[400];
char s[N + 10]; int main() {
//freopen("F:\\rush.txt", "r", stdin);
ios::sync_with_stdio(0), cin.tie(0);
is['a'] = is['e'] = is['i'] = is['o'] = is['u'] = 1;
cin >> (s+1);
n = strlen(s + 1);
int cnt = 0;
for (int i = 1; i <= n; i++) {
if (!is[s[i]]) {
cnt++;
if (cnt >= 3) {
bool ok = true;
int j = max(1, i - 2);
for (int k = j; k <= i - 1; k++)//前面的3个都和它一样吗
if (s[k] != s[i])
ok = false;
if (ok)//如果是的话
{
cout << s[i];
int k = i;
while (k + 1 <= n && s[k + 1] == s[i]) {//往后一直找和它一样的
k++;
cout << s[k];
}
cnt = 2;
i = k;//cnt变成2了,指向下一个。
}
else {//不是的话。只能分割了。
cout << ' '<<s[i];
cnt = 1;
}
}
else {
cout << s[i];//没3个
}
}
else {//是元音直接输出
cout << s[i];
cnt = 0;
}
}
//连续出现
return 0;
}
【codeforces 434 div 1 A】Did you mean...的更多相关文章
- 【Codeforces Round #434 (Div. 2) B】Which floor?
[链接]h在这里写链接 [题意] 在这里写题意 [题解] 枚举每层有多少个公寓就好. 要注意,每次都要从1到100判断,一下那个公寓该不该出现在那一层. 多个答案,如果答案是一样的.也算是唯一的. ...
- 【Codeforces Round #434 (Div. 1) B】Polycarp's phone book
[链接]h在这里写链接 [题意] 给你n个电话号码. 让你给每一个电话号码选定一个字符串s; 使得这个串s是这个电话号码的子串. 且不是任何一个其他电话号码的子串. s要求最短. [题解] 字典树. ...
- 【Codeforces Round #434 (Div. 2) A】k-rounding
[链接]h在这里写链接 [题意] 在这里写题意 [题解] 转换一下就是求n和10^k的最小公倍数. [错的次数] 0 [反思] 在这了写反思 [代码] #include <bits/stdc++ ...
- 【codeforces #282(div 1)】AB题解
A. Treasure time limit per test 2 seconds memory limit per test 256 megabytes input standard input o ...
- 【codeforces.com/gym/100240 J】
http://codeforces.com/gym/100240 J [分析] 这题我搞了好久才搞出样例的11.76....[期望没学好 然后好不容易弄成分数形式.然后我‘+’没打..[于是爆0... ...
- 【Codeforces Beta Round #45 D】Permutations
[题目链接]:http://codeforces.com/problemset/problem/48/D [题意] 给你n个数字; 然后让你确定,这n个数字是否能由若干个(1..x)的排列连在一起打乱 ...
- 【Codeforces Beta Round #88 C】Cycle
[Link]:http://codeforces.com/problemset/problem/117/C [Description] 问你一张图里面有没有一个三元环,有的话就输出. [Solutio ...
- 【Codeforces Global Round 1 E】Magic Stones
[链接] 我是链接,点我呀:) [题意] 你可以把c[i]改成c[i+1]+c[i-1]-c[i] (2<=i<=n-1) 问你能不能把每一个c[i]都换成对应的t[i]; [题解] d[ ...
- 【Codeforces Global Round 1 C】Meaningless Operations
[链接] 我是链接,点我呀:) [题意] 给你一个a 让你从1..a-1的范围中选择一个b 使得gcd(a^b,a&b)的值最大 [题解] 显然如果a的二进制中有0的话. 那么我们就让选择的b ...
随机推荐
- Centos7.0 Vmware10.0.3 网络桥接配置
首先要将Vmware10.0.3设置为桥接模式. CentOS 7.0默认安装好之后是没有自动开启网络连接的! cd /etc/sysconfig/network-scripts/ #进入网络配置 ...
- python 中文文档地址总结
sqlalchemy: https://www.imooc.com/article/details/id/22343
- 微信小程序从零开始开发步骤(五)轮播图
上一章完成页面自定义分享,这一章来说说轮播图,最常见的一个轮播图,中间带小圆点,自动轮播. Swiper是滑动特效插件,面向手机.平板电脑等移动终端.能实现触屏焦点图.触屏Tab切换.触屏多图切换等常 ...
- 洛谷——P2957 [USACO09OCT]谷仓里的回声Barn Echoes
https://www.luogu.org/problem/show?pid=2957 题目描述 The cows enjoy mooing at the barn because their moo ...
- 洛谷 P1177 【模板】快速排序(排序算法整理)
P1177 [模板]快速排序 题目描述 利用快速排序算法将读入的N个数从小到大排序后输出. 快速排序是信息学竞赛的必备算法之一.对于快速排序不是很了解的同学可以自行上网查询相关资料,掌握后独立完成.( ...
- 【Android】利用安卓的数据接口、多媒体处理编写内存卡Mp3播放器app
通过调用安卓的MediaPlayer能够直接完毕Mp3等主流音频的播放,同一时候利用ContentResolver与Cursor能够直接读取安卓内在数据库的信息.直接获取当前sdcard中全部音频的列 ...
- 利用淘宝ip库限制地区访问
https://sss.one/97.html 利用淘宝ip库限制地区访问 有些应用可能需要对某些地区的用户进行限制访问 在采用才此方法的时候,可以利用一些ip库对访问者的ip进行判断 淘宝ip库地址 ...
- JS 图片大小自动调整 (img)
<script> function dlutChangeImg(){ var maxwidth = 598; var obj = document.getElementById('bbs_ ...
- R 语言下常用第三方库的说明
1. doBy 官方文档见 CRAN - Package doBy doBy 主要适用于以下操作: 1) Facilities for groupwise computations of summar ...
- matlab 构建数据集实用 api
我们当前有如下目录结构的图像数据集(用于图像分类): 1. imageDatastore imageDatastore:imds = imageDatastore('./images', 'Inclu ...