757A Gotta Catch Em' All!
1 second
256 megabytes
standard input
standard output
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<iostream>
using namespace std;
int f[];
int main(){
string s;
cin>>s;
for(int i=;i<s.size();i++)
f[s[i]]++;
int ans;
ans=min(f['B'],min(f['u']/,min(f['l'],min(f['b'],min(f['a']/,min(f['s'],f['r']))))));
cout<<ans;
}
757A Gotta Catch Em' All!的更多相关文章
- 【codeforces 757A】Gotta Catch Em' All!
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- CodeForces757A
A. Gotta Catch Em' All! time limit per test 1 second memory limit per test 256 megabytes input stand ...
- Codeforces Round #391 A B C D E
A. Gotta Catch Em' All! 题意 从给定的字符串中选取字符,问可构成多少个\(Bulbasaur\) // 想到柯南里一些从报纸上剪汉字拼成的恐吓信_(:з」∠)_ Code #i ...
- Java性能提示(全)
http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...
- JVM源码分析之javaagent原理完全解读
概述 本文重点讲述javaagent的具体实现,因为它面向的是我们Java程序员,而且agent都是用Java编写的,不需要太多的C/C++编程基础,不过这篇文章里也会讲到JVMTIAgent(C实现 ...
- JVM插庄之二:Java agent基础原理
javaagent 简介 Javaagent 只要作用在class被加载之前对其加载,插入我们需要添加的字节码. Javaagent面向的是我们java程序员,而且agent都是用java编写的,不需 ...
- JVM源码分析之javaagent原理完全解读--转
原文地址:http://www.infoq.com/cn/articles/javaagent-illustrated 概述 本文重点讲述javaagent的具体实现,因为它面向的是我们Java程序员 ...
- JVM 源码分析之 javaagent 原理完全解读
转载:https://infoq.cn/article/javaagent-illustrated 本文重点讲述 javaagent 的具体实现,因为它面向的是我们 Java 程序员,而且 agent ...
- 2016-2017 ACM-ICPC Northwestern European Regional Programming Contest (NWERC 2016)
A. Arranging Hat $f[i][j]$表示保证前$i$个数字有序,修改了$j$次时第$i$个数字的最小值. 时间复杂度$O(n^3m)$. #include <bits/stdc+ ...
随机推荐
- System Error:/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found
System Error:/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found 1.运行程序是,系统报错库文件libstdc++. ...
- 两个栈实现队列 Python实现
# coding=utf-8 MAX_LENGTH = 100 SUCCESS = 1 FAIL = 0 ERROR = -1 class Queue(object): stack_fir = Non ...
- 显式锁(四)Lock的等待通知机制Condition
任意一个Java对象,都拥有一组监视器方法(定义在根类Object上),主要包括:wait( ).wait(long timeout).notify().notifyAll()方法:这些方法与关 ...
- css之为文本添加线性渐变和外描边
css之为文本添加线性渐变和外描边 一.效果: 描边:描边+渐变: 二.描边: api:text-stroke 问题:text-stroke的描边是居中描边,无法直接设置外描边 解决:在before ...
- leetcode367
public class Solution { public bool IsPerfectSquare(int num) { , high = num; while (low <= high) ...
- 机器学习入门-提取文章的主题词 1.jieba.analyse.extract_tags(提取主题词)
1.jieba.analyse.extract_tags(text) text必须是一连串的字符串才可以 第一步:进行语料库的读取 第二步:进行分词操作 第三步:载入停用词,同时对分词后的语料库进行 ...
- typscript 语法1
let isDone: boolean = false; let decLiteral: number = 0xf00d; let names: string = 'boob'; /** 使用模版字符 ...
- css兼容性记录
* , ie6,ie7可以识别: _和- , ie6可以识别: !important ,表示高优先级,ie7及以上,firefox都支持,ie6认识带!important的样式属性, ...
- mongodb基础学习14-mapReduce操作
mapReduce随着大数据的兴起而流行,相当于传统数据库的group操作,强项在于分布式计算. map:将一组记录的相关信息映射到一个数组 reduce:对map得到的数组数据进行处理得到一个结果 ...
- mongodb基础学习10-手动预分片
手动预分片是提前对分片创建一定数量足够使用的chunk,这样避免了IO上的压力 先对要演示的表进行分片 调用splitAt函数进行手动预分片,第一个参数指定要预分片的表,第二个参数指定分片规则,即当u ...