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

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

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

  1. import java.io.PrintWriter;
  2. import java.util.Arrays;
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6. public static final String s="Bulbasr";
  7. public static int cnt[]=new int[s.length()];
  8. public static void main(String[] args) {
  9. Scanner cin = new Scanner(System.in);
  10. PrintWriter out = new PrintWriter(System.out);
  11. String str=cin.nextLine();
  12. Arrays.fill(cnt, 0);
  13. for(int i=0;i<str.length();i++){
  14. for(int j=0;j<s.length();j++){
  15. if(str.charAt(i)==s.charAt(j)){
  16. cnt[j]++;break;
  17. }
  18. }
  19. }
  20. 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]);
  21. out.println(ans);
  22. cin.close();
  23. out.flush();
  24. }
  25. }

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. Task1.PyTorch的基本概念

    1.什么是Pytorch,为什么选择Pytroch? PyTorch的前身便是Torch,其底层和Torch框架一样,但是使用Python重新写了很多内容,不仅更加灵活,支持动态图,而且提供了Pyth ...

  2. swan.after

    解释: swan.after可以拦截所有当前运行小程序对于API的调用,默认传入function时,只在API函数调用的返回阶段拦截.如果传入Object,则可以选择拦截的阶段(例如: 返回阶段.回调 ...

  3. elasticsearch-head插件添加安全认证

    elasticsearch-head是集群管理.数据可视化.增删查改.查询语句可视化工具;它可以对数据进行增删查改,对于数据安全来说是有风险的,因此在生产环境中尽量少用,使用该插件至少要限制ip地址或 ...

  4. 20180708-Java运算符

    public class Test{ public static void main(String args[]){ int a = 10; int b = 20; int c = 25; int d ...

  5. 前端每日实战:6# 视频演示如何用纯 CSS 绘制一颗闪闪发光的璀璨钻石

    效果预览 按下右侧的"点击预览"按钮在当前页面预览,点击链接全屏预览. https://codepen.io/zhang-ou/pen/qYqwQp 可交互视频教程 此视频是可以交 ...

  6. php函数名前添加& 函数的引用返回

    function &test(){ static $b=0; $b= $b+1; return $b; } $a= test(); echo $a,"\n"; $a = 3 ...

  7. js/jq 小功能函数

    1.点击复制内容到剪贴板 function copyToClip(str) { var save = function(e) { e.clipboardData.setData('text/plain ...

  8. HDU 5634 Rikka with Phi

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5634 ------------------------------------------------ ...

  9. Python笔记(十四)_永久存储pickle

    pickle模块:将所有的Python对象转换成二进制文件存放 应用场景:编程时最好将大对象(列表.字典.集合等)用pickle写成永久数据包供程序调用,而不是直接写入程序 写入过程:将list转换为 ...

  10. 【ABAP系列】SAP ABAP 给初学者-解读function函数的export和import等参数

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ABAP 给初学者-解读 ...