733A Grasshopper And the String
来源:互联网 发布:蓝桥杯全国软件大赛 编辑:程序博客网 时间:2024/05/21 20:25
题目链接:
http://codeforces.com/contest/733/problem/A
题解:
一个蚱蜢跳格子,它只会跳有元音字母(包括了’Y’),问你跳的最大的距离是多少。
水题(一开始思考的方向想错,以后还是要多做题目)。
代码:
#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace std;const int maxn = 100+10;#define met(a,b) memset(a,b,sizeof(a))#define inf 0x3f3f3f3fchar s[maxn];int main(){ scanf("%s",s); int len = strlen(s); int ans=0,cnt=0; for(int i=0;i<len;i++) { cnt++; if(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y') { ans=max(ans,cnt); cnt=0; } } if(!(s[len-1]=='A'||s[len-1]=='E'||s[len-1]=='I'||s[len-1]=='O'||s[len-1]=='U'||s[len-1]=='Y')) cnt++; ans=max(cnt,ans); printf("%d\n",ans);}
0 0
- Codeforces 733A Grasshopper And the String
- codeforces--733A. Grasshopper And the String
- CodeForces 733A - Grasshopper And the String
- 733A Grasshopper And the String
- Codeforces 733A Grasshopper And the String
- A. Grasshopper And the String
- A. Grasshopper And the String
- 【非常高%】【codeforces 733A】Grasshopper And the String
- 733A Grasshopper And the String codeforces(水题)
- CodeForces 733A Grasshopper And the String(水题)
- CodeForces 733 A.Grasshopper And the String(水~)
- Grasshopper And the String
- Grasshopper And the String
- codeforces733A.Grasshopper And the String
- NYOJ Grasshopper And the String
- Codeforces Round #378 (Div. 2)A. Grasshopper And the String
- Codeforces Round #378 (Div. 2) A. Grasshopper And the String
- codeforces#378 Div.2 A. Grasshopper And the String
- google chrome 快捷键
- linux(ubuntu)为用户增加sudo权限
- SpringMVC深度探险-SpringMVC概览
- 多线程切换以及线程进程之间关系
- 浅谈 MVP in Android
- 733A Grasshopper And the String
- 程序员之路的重新思索
- 函数ZwQuerySystemInformation小结
- Android proguard代码混淆
- 数组常见算法
- HackerRank
- Winform跨线程打印日志到TextBox(使用委托跨线程访问控件)
- linux vi 删除多行的方法
- (转)三分问题 + UVALive 6954 Euclidean TSP