Codeforces 429 A. Generous Kefa
来源:互联网 发布:西方伦理思想史淘宝 编辑:程序博客网 时间:2024/06/08 09:21
题目网址: Codeforces 429 A. Generous Kefa
思路
- 计数每种颜色气球的个数
- 若某种颜色气球颜色多于k,则输出NO,否则YES
代码
#include <bits/stdc++.h>using namespace std;const int SIZE = 105;char color[SIZE];unordered_map<char, int> mp;int main(int argc, char const *argv[]){ int n, k; while (~scanf("%d %d", &n, &k)) { bool flag = true; mp.clear(); scanf("%s", color); for (int i = 0; i < n; ++i) { ++mp[color[i]]; if (mp[color[i]] > k) { flag = false; } } if(flag) printf("YES\n"); else printf("NO\n"); } return 0;}
阅读全文
0 0
- Codeforces 429 A. Generous Kefa
- Codeforces-429-2-A Generous Kefa
- 429A. Generous Kefa
- codeforces 841A Generous Kefa
- codeforces 841A Generous Kefa
- Codeforces Round #429 (Div. 2) 841A Generous Kefa(水)
- Codeforces Round #429 (Div. 2):A. Generous Kefa
- Codeforces Round #429 (Div. 2) | A. Generous Kefa
- Generous Kefa CodeForces
- A. Generous Kefa
- A. Generous Kefa(Round #429 (Div. 2))
- Codeforces 841 Generous Kefa(模拟)
- Generous Kefa
- CF Generous Kefa(水)
- CodeForces 580A Kefa and First Steps
- Codeforces 580A Kefa and First Steps
- Codeforces-580A-Kefa and First Steps
- CodeForces 580A Kefa and First Steps
- 视图View的基本属性
- 一步一步教你centos7安装nginx1.13.4
- 职业生涯系列 – 职业倦怠
- 在IIS下部署SSL证书实现HTTPS
- java线程锁之lock
- Codeforces 429 A. Generous Kefa
- c#调用c++dll共享内存需要函数
- Spring boot入门六 服务配置与集成
- spring-boot-multi-datasource(spring-boot多路数据源)
- Ubuntu14.04下Vim的安装与配置
- 异常数据剔除
- 1.Android注解-编译时生成代码 APT(Annotation Processing Tool ) Poet 说明
- CSS 变量教程
- GitHub 的 试用说明