依照题意暴力模拟即可A掉

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
using namespace std;
char s[];
int n,k,barrel[];
int main(){
scanf("%d %d",&n,&k);
scanf("%s",s+);
for(int i=;i<=n;i++)
barrel[s[i]-'A'+]++;
int ans=0x3f3f3f3f;
for(int i=;i<=k;i++)
ans=min(ans,barrel[i]);
printf("%d\n",ans*k);
return ;
}

题解——Codeforces Round #508 (Div. 2) T1 (模拟)的更多相关文章

  1. 题解——Codeforces Round #508 (Div. 2) T3 (贪心)

    贪心的选取最优解 然后相减好 记得要开long long #include <cstdio> #include <algorithm> #include <cstring ...

  2. 题解——Codeforces Round #508 (Div. 2) T2 (构造)

    按照题意构造集合即可 注意无解情况的判断 #include <cstdio> #include <algorithm> #include <cstring> #in ...

  3. Codeforces Round #508 (Div. 2)

    Codeforces Round #508 (Div. 2) http://codeforces.com/contest/1038 A #include<bits/stdc++.h> us ...

  4. [题解] Codeforces Round #549 (Div. 2) B. Nirvana

    Codeforces Round #549 (Div. 2) B. Nirvana [题目描述] B. Nirvana time limit per test1 second memory limit ...

  5. Codeforces 1038F Wrap Around (Codeforces Round #508 (Div. 2) F) 题解

    写在前面 此题数据量居然才出到\(n=40\)???(黑人问号)以下给出一个串长\(|S|=100,n=10^9\)的题解. 题目描述 给一个长度不超过\(m\)的01串S,问有多少个长度不超过\(n ...

  6. Codeforces Round #508 (Div. 2) D. Slime

    D. Slime 题目链接:https://codeforces.com/contest/1038/problem/D 题意: 给出两个数,然后每次可以对相邻的两个数合并,比如x,y,那么合并过后就是 ...

  7. Codeforces Round #366 (Div. 2) C 模拟queue

    C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...

  8. Codeforces Round #508 (Div. 2) E. Maximum Matching(欧拉路径)

     E. Maximum Matching 题目链接:https://codeforces.com/contest/1038/problem/E 题意: 给出n个项链,每条项链左边和右边都有一种颜色(范 ...

  9. Codeforces Round #281 (Div. 2) B 模拟

    B. Vasya and Wrestling time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

随机推荐

  1. 解释器模式 Interpreter

    代码例子 参考 1.解释器模式定义 给定一个语言,定义它的文法的一种表示,并定义一个解释器,这个解释器使用该表示来解释语言中的句子. 说明:解释器模式设计到文法规则和抽象语法树. 2.解释器模式的结构 ...

  2. maven编译不通过:软件包com.sun.org.apache.xml.internal.security.utils.Base64 不存在

     问题:代码中使用了sun公司的第三方私有库,导致编译不通过 maven打包异常:软件包com.sun.org.apache.xml.internal.security.utils.Base64 不存 ...

  3. Ubuntu 为 root 帐号开启 SSH 登录

    1. 修改 root 密码sudo passwd root 2. 以其他账户登录,通过 sudo nano 修改 /etc/ssh/sshd_config :xxx@ubuntu:~$ su - ro ...

  4. Step7:SQL Server 多实例下的复制

    一.本文所涉及的内容(Contents) 本文所涉及的内容(Contents) 背景(Contexts) 搭建步骤(Procedure) 注意事项(Attention) 二.背景(Contexts) ...

  5. Porsche Piwis Tester II Diagnostic Tool -Next Generation of PIWIS Tester KTS520

    Porsche Piwis Tester II is the latest inspect equipment of Porsche Company. This is the latest profe ...

  6. 如何在Linux中使用Firejail运行应用程序

    有时您可能希望使用在不同环境中未经过良好测试的应用程序,但您必须使用它们.在这种情况下,关注系统的安全性是正常的.在Linux中可以做的一件事是在沙箱中使用应用程序. “沙盒”是在有限环境中运行应用程 ...

  7. 如何用nginx在本地把9000端口转发到80端口上

    起因看到一个用java写的轻博客,于是就兴致冲冲的试用一下.由于是lnmp的环境,Nginx占用了80端口,新博客只能用其他的端口,这里选择了9000端口,本地测试没问题.总不能访问了域名然后在加上端 ...

  8. Spring IOC 和 AOP

    一. IOC 1. 概念及原理 IOC: Inversion of Control(控制反转)是一种设计思想,就是容器控制应用程序所需要的外部资源的创建和管理,然后将其反转给应用程序.对象及其依赖对象 ...

  9. centos7 安装zabbix

    一.安装mysql 1.[root@iZ28gvqe4biZ ~]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.n ...

  10. EditPlus配置GCC

    --GCC Compile-- 命令:D:\GCC\MinGW_RP_Green\bin\gcc.exe 参数:$(FileName) -o $(FileNameNoExt).exe 初始目录:$(F ...