题目链接:http://codeforces.com/contest/757/problem/A

题意:给定一个字符串,问你从这个字符串中选出一些字符然后重新排序后最多能组成多少个 Bulbasaur

思路:统计每个字符出现的次数即可,然后各个字符串的最小值即为最多的个数

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner; public class Main {
public static final String s="Bulbasr";
public static int cnt[]=new int[s.length()];
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
String str=cin.nextLine();
Arrays.fill(cnt, 0);
for(int i=0;i<str.length();i++){
for(int j=0;j<s.length();j++){
if(str.charAt(i)==s.charAt(j)){
cnt[j]++;break;
}
}
}
int ans=Math.min(Math.min(Math.min(Math.min(Math.min(Math.min(cnt[0], cnt[1]/2), cnt[2]), cnt[3]), cnt[4]/2), cnt[5]), cnt[6]);
out.println(ans);
cin.close();
out.flush();
}
}

Codecraft-17 and Codeforces Round #391 - A的更多相关文章

  1. Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined)

    传送门:http://codeforces.com/contest/757 A题题意是给你一个字符串,让你在里面找到"Bulbasaur"这样的单词有多少个,字符串可以重排列.实际 ...

  2. Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined)D. Felicity's Big Secret Revealed

    题目连接:http://codeforces.com/contest/757/problem/D D. Felicity's Big Secret Revealed time limit per te ...

  3. vector的哈希值 Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) C

    http://codeforces.com/contest/757/problem/C 题目大意:有n个导管,每个体育馆有k种神奇宝贝,然后所有的n个体育馆中,一共有m中神奇宝贝.可知,每个神奇宝贝中 ...

  4. Codeforces Round #391 C. Felicity is Coming!

    题目链接 http://codeforces.com/contest/757/problem/C 题意:给你n组数范围在1-m,可进行变换f(x)=y,就是将所有的x全变成y,最后 要满足变化后每组数 ...

  5. Codecraft-17 and Codeforces Round #391 - C

    题目链接:http://codeforces.com/contest/757/problem/C 题意:给定n个gym和m个Pokemon的类型,然后给你每个gym内的Pokemon未进化之前的类型, ...

  6. Codecraft-17 and Codeforces Round #391 - B

    题目链接:http://codeforces.com/contest/757/problem/B 题意:给定n个数字,问最多能选个多少个数字使得选出来的数字的gcd!=1. 思路:由于数字最大为1e5 ...

  7. Codeforces Round #391 div1 757F (Dominator Tree)

    首先先膜杜教orz 这里简单说一下支配树的概念 支配树是对一个有向图来讲的 规定一个起点s,如果s到v的路径上必须经过某些点u,那么离s最近的点u就是v的支配点 在树上的关系就是,v的父亲是u. 一般 ...

  8. Codeforces Round #391 A B C D E

    A. Gotta Catch Em' All! 题意 从给定的字符串中选取字符,问可构成多少个\(Bulbasaur\) // 想到柯南里一些从报纸上剪汉字拼成的恐吓信_(:з」∠)_ Code #i ...

  9. Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) C

    It's that time of the year, Felicity is around the corner and you can see people celebrating all aro ...

随机推荐

  1. python其他篇(1)

    1.跳过anaconda直接打开spyder或qtconsole: 打开终端,输入spyder或者jupyter-qtconsole 2.conda安装jpype1和pyhanlp: 参考:http: ...

  2. php strrpos()函数 语法

    php strrpos()函数 语法 作用:寻找某字符串中某字符最后出现的位置.大理石构件怎么选择 语法:strrpos(string,find,start) 参数: 参数 描述 string 必需. ...

  3. 循序渐进实现仿QQ界面(二):贴图按钮的三态模拟

    开始之前先说一下RingSDK的编译问题,这里演示的程序需要用到最新版本的RingSDK,请务必用SVN到svn://svnhost.cn/RingSDK更新到最新版本,推荐用TortoiseSVN. ...

  4. Seek the Name, Seek the Fame (poj2752

    Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 14561   Ac ...

  5. python之-框架

    MVC:Model-View-Controller,中文名“模型-视图-控制器” C——Python处理URL的函数:Controller,Controller负责业务逻辑,比如检查用户名是否存在,取 ...

  6. sql语句insert into where 错误解析

    sql语句中,insert into 代表得是插入一条新得数据,全新得数据,所以你这样得写法是错误得,比如: "insert into klkl_Service_shop(name_real ...

  7. spring-cloud zuul网关

    API Gateway 是随着微服务(Microservice)这个概念一起兴起的一种架构模式,它用于解决微服务过于分散,没有一个统一的出入口进行流量管理的问题. 使用 Zuul 实现 API Gat ...

  8. node后台fetch请求数据-Hostname/IP doesn't match certificate's altnames解决方法

    一.问题背景 基于express框架,node后台fetch请求数据,报错Hostname/IP doesn't match certificate's altnames..... require(' ...

  9. 《图解设计模式》读书笔记4-1 Bridge模式

    目录 概念 代码 角色 类图 想法 概念 Bridge模式即桥接模式.顾名思义,这个模式的作用是将类的功能层次结构和类的实现层次结构连接起来. 功能层次结构 Something -SomethingG ...

  10. WPF数据模板中绑定事件不触发问题

    今天比较闲,做一个练手的项目,结果在xaml中写了一个用户的数据模板后,在其中的某个Canvas上绑定了一个鼠标左击的事件,结果调试的时候,无论怎么点击都不跳到断点那里,百思不得其解. 之后尝试不绑定 ...