【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 ...
随机推荐
- js---13 this call apply
//this:this可以写在js全剧环境中(全局环境中this是window对象),this可以写在函数中,可以写在对象中, function f(){ this.name = "asdf ...
- js插件---video.js如何使用
js插件---video.js如何使用 一.总结 一句话总结:还是要去官方网站去看英文文档.快点把英语学好啊. 1.如何快速使用这些插件(比如video.js)? 直接百度这些js如何使用就可以了,这 ...
- 怎样通过MSG_WAITALL设置阻塞时间,IO模式精细讲解: MSG_DONTWAIT 、 MSG_WAITALL
首先给出MSDN上一段设置阻塞超时的代码:(网址为http://social.msdn.microsoft.com/Forums/zh-SG/visualcpluszhchs/thread/3d9da ...
- golang binarySearch
func binarySearch(nodes []*node, word Text) (int, bool) { start := end := len(nodes) - // 特例: { // 当 ...
- sparksql不支持hive中的分区名称大写
但是在hive中查询是可以的. 后来经过一点一点测试发现,原来分区名称不能是大写,必须小写才行.
- 今日题解------codeforce 893d
题意:给你一个数列,小于零表示表示信用卡里取出钱,大于零表示信用卡里存钱,等于零表示要查询信用卡, 如果被查到信用卡里的钱小于零,那你就GG,或者在任何时候你的信用卡里的钱大于d的话(不需要找ai等于 ...
- Android中级第十讲--相机录像和查看系统相册图片
博客出自:http://blog.csdn.net/liuxian13183,转载注明出处! All Rights Reserved ! 录像比较简单,开始录制: myCamera.unlock(); ...
- [React] Define defaultProps and PropTypes as static methods in class component
class Toggle extends Component { static propTypes = { defaultOn: PropTypes.bool, on: PropTypes.bool, ...
- Irrlicht 3D Engine 笔记系列 之 教程5- User Interface
作者:i_dovelemon 日期:2014 / 12 / 18 来源:CSDN 主题:GUI 引言 今天.博主学习了第五个教程. 这个教程解说了怎样使用Irrlicht内置的一个基础模块.GUI模块 ...
- 【Cocos2d-x 017】 多分辨率适配全然解析
转:http://blog.csdn.net/w18767104183/article/details/22668739 文件夹从Cocos2d-x 2.0.4開始,Cocos2d-x提出了自己的多分 ...