Codeforces Round #378 (Div. 2) A. Grasshopper And the String(水题求跳跃距离)
来源:互联网 发布:微信美工工资一般多少 编辑:程序博客网 时间:2024/06/07 03:23
题目链接:http://codeforces.com/problemset/problem/733/A
【中文题意】就是找一下最长一次跳多远的距离,然后只有给定的那几个字母才可以踩在上面。
【思路分析】记录下来字符串中那几个字母的位置,注意多加两个点,一个是0,另外一个是字符串的长度+1 。
【AC代码】
#include<cstdio>#include<cstring>#include<algorithm>using namespace std;char a[1005],b[1005];int main(){ while(gets(a)) { int sum=1; b[0]=0; int len=strlen(a); for(int i=0;i<len;i++) { if(a[i]=='A'||a[i]=='E'||a[i]=='O'||a[i]=='I'||a[i]=='U'||a[i]=='Y') { b[sum++]=i+1; } } b[sum++]=len+1; int maxn=0; for(int i=1;i<sum;i++) { maxn=max(maxn,b[i]-b[i-1]); } printf("%d\n",maxn); } return 0;}
0 0
- Codeforces Round #378 (Div. 2) A. 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 Round #378 (Div. 2)A.Grasshopper And the String【水题】模拟
- codefroces Codeforces Round #378 (Div. 2) A. Grasshopper And the String
- codeforces#378 Div.2 A. Grasshopper And the String
- Codeforces Round #382 (Div. 2) A. Ostap and Grasshopper
- Codeforces Round #382 (Div. 2) 735A - Ostap and Grasshopper
- Codeforces Round #382 (Div. 2) A. Ostap and Grasshopper
- Codeforces Round #382 (Div. 2) 735A Ostap and Grasshopper
- Codeforces Round #382 (Div. 2) A. Ostap and Grasshopper
- Codeforces 733A Grasshopper And the String
- codeforces--733A. Grasshopper And the String
- CodeForces 733A - Grasshopper And the String
- Codeforces 733A Grasshopper And the String
- CodeForces 733A Grasshopper And the String(水题)
- CodeForces 733 A.Grasshopper And the String(水~)
- Codeforces Round #382 (Div. 2)-735A. Ostap and Grasshopper(BFS)
- 50 Android Studio Tips, Tricks & Resources you should be familiar with, as an Android Developer
- MonkeyRunner简介
- maven如何合并两个war到一个war项目中
- jvm参数选项要求
- 电商类APP H5与iOS和android混合开发问题记录
- Codeforces Round #378 (Div. 2) A. Grasshopper And the String(水题求跳跃距离)
- GiftCard
- JSP中<base href="<%=basePath%>">作用
- Python学习第二篇
- MSHR(Miss Status and Handling Register)
- Android 轻量级万能适配器,通吃所有的 AbsListView、RecyclerView
- 代理<delegate>、通知<NSNotification>、KVO三者之间的区别
- js 基础知识
- 2、网络请求——Android-Async-Http