Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) A
Bash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turned into an obsession. Since he is too young to go out and catch Bulbasaur, he came up with his own way of catching a Bulbasaur.
Each day, he takes the front page of the newspaper. He cuts out the letters one at a time, from anywhere on the front page of the newspaper to form the word "Bulbasaur" (without quotes) and sticks it on his wall. Bash is very particular about case — the first letter of"Bulbasaur" must be upper case and the rest must be lower case. By doing this he thinks he has caught one Bulbasaur. He then repeats this step on the left over part of the newspaper. He keeps doing this until it is not possible to form the word "Bulbasaur" from the newspaper.
Given the text on the front page of the newspaper, can you tell how many Bulbasaurs he will catch today?
Note: uppercase and lowercase letters are considered different.
Input contains a single line containing a string s (1 ≤ |s| ≤ 105) — the text on the front page of the newspaper without spaces and punctuation marks. |s| is the length of the string s.
The string s contains lowercase and uppercase English letters, i.e.
.
Output a single integer, the answer to the problem.
Bulbbasaur
1
F
0
aBddulbasaurrgndgbualdBdsagaurrgndbb
2
In the first case, you could pick: Bulbbasaur.
In the second case, there is no way to pick even a single Bulbasaur.
In the third case, you can rearrange the string to BulbasaurBulbasauraddrgndgddgargndbb to get two words "Bulbasaur".
题意:没啥好说的
解法:根据出现的字母,看能不能组合出来就行
#include <bits/stdc++.h>
using namespace std;
string s;
map<char,int>Mp;
int MAX=(<<)-;
//Bulbasaur
int main()
{
cin>>s;
int len=s.length();
for(int i=;i<len;i++){
Mp[s[i]]++;
}
MAX=min({MAX,Mp['B'],Mp['u']/,Mp['l'],Mp['b'],Mp['a']/,Mp['s'],Mp['r']});
cout<<MAX<<endl;
return ;
}
Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) A的更多相关文章
- Educational Codeforces Round 71 (Rated for Div. 2)-E. XOR Guessing-交互题
Educational Codeforces Round 71 (Rated for Div. 2)-E. XOR Guessing-交互题 [Problem Description] 总共两次询 ...
- Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship
Problem Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...
- Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)
Problem Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...
- Educational Codeforces Round 43 (Rated for Div. 2)
Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...
- Educational Codeforces Round 35 (Rated for Div. 2)
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...
- Educational Codeforces Round 63 (Rated for Div. 2) 题解
Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...
- Educational Codeforces Round 39 (Rated for Div. 2) G
Educational Codeforces Round 39 (Rated for Div. 2) G 题意: 给一个序列\(a_i(1 <= a_i <= 10^{9}),2 < ...
- Educational Codeforces Round 48 (Rated for Div. 2) CD题解
Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforce ...
随机推荐
- hdmap相关
图片来源:https://vires.com/ 新闻摘抄: 对此,武汉光庭信息技术股份有限公司副总经理罗跃军告诉记者:“事实上,最初由自动驾驶车身控制系统协会所提出的地图精度要求很高,需要达到5cm甚 ...
- Git_学习_04_ 多人协作开发的过程
多人协作的工作模式通常是这样: 1.首先,可以试图用 git push origin branch-name 推送自己的修改: 2.如果推送失败,则因为远程分支比你的本地更新,需要先用 git pul ...
- codeforces 659G G. Fence Divercity(dp)
题目链接: G. Fence Divercity time limit per test 2 seconds memory limit per test 256 megabytes input sta ...
- ubuntu c++ 关机 重启 挂起 API
#include <unistd.h> #include <linux/reboot.h> int main() { reboot(LINUX_REBOOT_MAGIC1, L ...
- MySQL常用的数据类型及函数_20160920
1.常用数据类型 针对创建数据表时候 需要指定字段的数据类型,我整理的是工作常用的几种 可以参考看下数据类型 http://www.w3school.com.cn/sql/sql_datatypes. ...
- 「UVA1636」Headshot(概率
题意翻译 你有一把枪(左轮的),你随机装了一些子弹,你开了一枪,发现没有子弹,你希望下一枪也没有子弹,你是应该直接开一枪(输出"SHOOT"),还是先转一下,再开一枪(输出&quo ...
- windwos 10 谷歌浏览器出现彩色闪条
应该是上个星期五开始,发现电脑从别的地方切换到谷歌浏览器就会出现闪条,开始也没太注意,但是到周一还是这样,所以再网上查了下, 说什么的都有,什么你按脑屏幕坏了,内存条不行什么是的.后来才发现原来是谷歌 ...
- python使用uuid生成唯一id或str
介绍: UUID是128位的全局唯一标识符,通常由32字节的字符串表示. 使用: import uuid print uuid.uuid1() 14bfe806-f1c7-11e6-83b5-0680 ...
- CHAKRA3 UART2
APP下: 配置BD文件: #define PADS_TCON_CONFIG Unknown_pad_mux #define PADS_UART2_MODE Unknown_pad_mux #defi ...
- windows下VisualStudio和QtCreator搭建Qt开发环境
一.简介 集成开发平台IDE都有各自的长处,编写Qt程序可根据自己的喜好来选择相应的IDE.下述文章都是装载博友的文章,其中有很多细节还得自己调整. 二.详解 1.VisualStudio搭建Qt开发 ...