题解——Codeforces Round #508 (Div. 2) T1 (模拟)
依照题意暴力模拟即可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 (模拟)的更多相关文章
- 题解——Codeforces Round #508 (Div. 2) T3 (贪心)
贪心的选取最优解 然后相减好 记得要开long long #include <cstdio> #include <algorithm> #include <cstring ...
- 题解——Codeforces Round #508 (Div. 2) T2 (构造)
按照题意构造集合即可 注意无解情况的判断 #include <cstdio> #include <algorithm> #include <cstring> #in ...
- Codeforces Round #508 (Div. 2)
Codeforces Round #508 (Div. 2) http://codeforces.com/contest/1038 A #include<bits/stdc++.h> us ...
- [题解] Codeforces Round #549 (Div. 2) B. Nirvana
Codeforces Round #549 (Div. 2) B. Nirvana [题目描述] B. Nirvana time limit per test1 second memory limit ...
- Codeforces 1038F Wrap Around (Codeforces Round #508 (Div. 2) F) 题解
写在前面 此题数据量居然才出到\(n=40\)???(黑人问号)以下给出一个串长\(|S|=100,n=10^9\)的题解. 题目描述 给一个长度不超过\(m\)的01串S,问有多少个长度不超过\(n ...
- Codeforces Round #508 (Div. 2) D. Slime
D. Slime 题目链接:https://codeforces.com/contest/1038/problem/D 题意: 给出两个数,然后每次可以对相邻的两个数合并,比如x,y,那么合并过后就是 ...
- 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 ...
- Codeforces Round #508 (Div. 2) E. Maximum Matching(欧拉路径)
E. Maximum Matching 题目链接:https://codeforces.com/contest/1038/problem/E 题意: 给出n个项链,每条项链左边和右边都有一种颜色(范 ...
- Codeforces Round #281 (Div. 2) B 模拟
B. Vasya and Wrestling time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
随机推荐
- Tornado安装
Tornado 和现在的主流 Web 服务器框架(包括大多数 Python 的框架)有着明显的区别:它是非阻塞式服务器,而且速度相当快.得利于其 非阻塞的方式和对 epoll 的运用,Tornado ...
- hive 将一个分区表数据全部插入另外一个分区表
假如现在hive有个分区表A,分区字段为dt 需求是:需要将A表中的数据全部插入到分区表B中 具体步骤如下: 1.create B like A: 2.插入数据 set hive.exec.dynam ...
- Javascript创建类的七种方法
/* 第一种定义类的方法 */var cls = new Object();cls.name = "wyf";cls.showName = function(){console.l ...
- ASP.NET Core Web API 索引 (更新Redis in .NET Core)
https://www.cnblogs.com/cgzl/p/9178672.html
- C++ 开源库列表
https://zh.cppreference.com/w/cpp/links/libs
- jpg、gif、png-8、png-24的区别
一.gif格式的特点 1.透明性.gif是一种布尔透明类型,即它可以是全透明,也可以是全不透明,但是没有半透明 2.动画.gif支持动画 3.无损耗性.gif是一种无损耗的图像格式,这意味着你可以对g ...
- Eclipse Luna在线安装Maven时报错:Java heap space
问题描述: 在线安装Maven插件时发生了:Java heap space 问题截图:
- yocto doc
Yocto Project Overview and Concepts Manual https://www.yoctoproject.org/docs/2.6.1/overview-manual/o ...
- Linux centos7下php安装cphalcon扩展的方法
说明: 操作系统:CentOS7 php安装目录:/usr/local/php php.ini配置文件路径:/usr/local/php/etc/php.ini 运行环境:LNMP ,PHP7 .安装 ...
- 关于我在17号“一个查询任意年份中任意月份的天数”程序编写中的代码&第二种方法!
PS:下面的代码是我对于17号的练习题的一些新的看法(其实就是从另一个角度思考问题) package day20180917;import java.util.Scanner;//导包public c ...