Generous Kefa CodeForces
来源:互联网 发布:《怪物》 韩国 知乎 编辑:程序博客网 时间:2024/05/18 17:27
大水题
妈耶,,,我竟然写出了bug
下面是 AC 代码
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <set>#include <map>#include <stack>#include <queue>#include <ctype.h>#include <vector>#include <algorithm>#define in freopen("in.txt", "r", stdin)#define out freopen("out.txt", "w", stdout)// cout << " === " << endl;using namespace std;typedef long long ll;const int maxn = 1000 + 7, INF = 0x7f7f7f7f, mod = 1e9+7;int n, k;char s[maxn];int main() { scanf("%d %d", &n, &k); scanf("%s", s); for(int i = 0; i < n; ++i) { if(s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a'; } sort(s, s+n); int cnt = 1; for(int i = 1; i < n; ++i) { if(s[i] != s[i-1]) cnt = 1; else { cnt++; if(cnt > k) { puts("NO"); return 0; } } } puts("YES"); return 0;}
阅读全文
1 0
- Generous Kefa CodeForces
- codeforces 841A Generous Kefa
- codeforces 841A Generous Kefa
- Codeforces 429 A. Generous Kefa
- Codeforces 841 Generous Kefa(模拟)
- Codeforces-429-2-A Generous Kefa
- 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
- 429A. Generous Kefa
- A. Generous Kefa
- CF Generous Kefa(水)
- A. Generous Kefa(Round #429 (Div. 2))
- Kefa and Dishes CodeForces
- Kefa and Company Codeforces#321
- Codeforces Kefa and First Steps
- Codeforces,Kefa and Dishes,状态压缩DP
- 实现LVS-NAT
- Linux Hook技术实践
- 快速排序详解
- hdu5213 Lucky 莫队算法+容斥
- 2017.08.19 自动关机脚本.vbs
- Generous Kefa CodeForces
- 记忆化搜索
- matlab中图像处理的基本函数(2)
- 485串口通讯保存流量计的数据到Excel
- 流行编程语言的详细对比(1)--Hello World和注释
- session超时,登陆界面嵌套
- 树状数组学习
- windows与linux双系统 时间不匹配问题
- hdu2222Keywords Search(AC自动机模板题)