Problem D. Clones and Treasures XVII Open Cup named after E.V. Pankratiev||简单模拟
来源:互联网 发布:淘宝上种草是什么意思 编辑:程序博客网 时间:2024/05/20 14:19
题目:
简单模拟一下就行。
AC代码:
/*2017年8月29日20:29:12 Problem D. Clones and Treasures AC签到 */#include <iostream>#include <map>#include <set>#include <string>#include <cstring>#include <cstdio>#include <algorithm>#include <cmath>#include <queue>#include <vector> using namespace std;const int maxn=1e6+10;char s[maxn]; void solve(){int len=strlen(s);int cur_h=0,cur_g=0,mx=0,ans;for(int i=0;i<len;i++){if(s[i]=='K'){if(cur_h<1) cur_g=0;else cur_h--;} else if(s[i]=='H'){cur_h++;}else if(s[i]=='M'){cur_g++;mx=max(cur_g,mx);}}printf("%d\n",mx);}int main(){while(~scanf("%s",s)){solve();}return 0;}
阅读全文
0 0
- Problem D. Clones and Treasures XVII Open Cup named after E.V. Pankratiev||简单模拟
- XVII Open Cup named after E.V. Pankratiev. Eastern Grand Prix. Problem G. Gmoogle 模拟、字符串处理、文本搜索
- Problem A. Arithmetic Derivative-XVII Open Cup named after E.V. Pankratiev||找规律&数学&DFS
- Problem L. Canonical duel XVII Open Cup named after E.V. Pankratiev||并查集
- Problem F. Matrix Game XVII Open Cup named after E.V. Pankratiev||字符串最大表示法
- XVII Open Cup named after E.V. Pankratiev. Grand Prix of SPb D cutting potatoes
- XVII Open Cup named after E.V. Pankratiev. Eastern Grand Prix. Problem F. Buddy Numbers 贪心、数论、构造
- XVII Open Cup named after E.V. Pankratiev. XXI Ural Championship G glassese of solutions
- XVII Open Cup named after E.V. Pankratiev Problem I. Rage Minimum Query 手写小根堆、卡时间+卡内存、或者随机化
- 【opencup】XVI Open Cup named after E.V. Pankratiev. GP of SPB K.Captain Tarjan【树形dp】
- Problem D. Championships 图论 连通分量/度数 Warsaw U Contest, XVI Open Cup Onsite
- Open Source Game Clones
- Open Source Game Clones
- Open Source Game Clones
- A. Rotate, Flip and Zoom(VK Cup 2015 - Qualification Round 2 简单模拟)
- Canada Cup 2016 A,B,C,D,E
- [CodeForces-325D] [Problem E]Reclamation
- Problem D: CX and girls
- 日期工具类DateUtils
- std::vector---swap
- android studio卡在 Building 'android' Gradle project info
- Aspose.Cells Excel导出导入
- 阿里云ECS服务器申请和配置(Windows镜像)
- Problem D. Clones and Treasures XVII Open Cup named after E.V. Pankratiev||简单模拟
- 微信支付通知方法-附上部分代码
- TabLayout的TabItem自定义
- 大富翁游戏
- TaskRun 方法
- PHP设计模式-单例模式(Singleton For PHP)
- php长连接和短连接
- JS几种数组遍历方式以及性能分析对比
- 输入一个链表,反转链表后,输出链表的所有元素。