codeforces 999 C. Alphabetic Removals(1200)
链接:https://codeforces.ml/problemset/problem/999/C
题意:对字符串按顺序删除给定数量的字母
题解:模拟;
代码:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int num[26] = { 0 };
int main()
{int n, k;cin >> n >> k;string s;cin >> s;string t = s;sort(s.begin(), s.end());for (int i = 0; i < k; i++){num[s[i] - 'a']++;}for (int i = 0; i < t.size(); i++){if (num[t[i] - 'a']){num[t[i] - 'a']--;}else{cout << t[i];}}return 0;
}
codeforces 999 C. Alphabetic Removals(1200)相关推荐
- Codeforces Round #249 (Div. 2) (模拟)
Codeforces Round #249 (Div. 2) (模拟) C. Cardiogram time limit per test 1 second memory limit per test ...
- Codeforces Round #791 (Div. 2)(A-D)
Codeforces Round #791 (Div. 2)(A-D) A. AvtoBus 题意: 给你 n, 问满足 4x+6y=n4x+6y=n4x+6y=n 的 x+yx+yx+y的最小值和最 ...
- 【Codeforces】913C Party Lemonade (贪...)。
http://codeforces.com/contest/913/problem/C 这个题和以前见过的有点不一样,可以重复选择,这个有点emmm 首先将a数组优化,举个例子,如果1L20元,2L5 ...
- CodeForces 321A Ciel and Robot(数学模拟)
题目链接:http://codeforces.com/problemset/problem/321/A 题意:在一个二维平面中,开始时在(0,0)点,目标点是(a,b),问能不能通过重复操作题目中的指 ...
- Codeforces Round #644 (Div. 3)(A-E)
这场的A-E都是水题,就简单记录一下吧. Minimal Square CodeForces - 1360A 思路:我们令b=max(a,b),a=min(a,b). 如果b>=2*a的话,最终 ...
- Codeforces Round #573 (Div. 2)(ABCD)
Tokitsukaze and Enhancement CodeForces - 1191A Tokitsukaze is one of the characters in the game &quo ...
- Codeforces Round #572 (Div. 2)(ABCD1D2E)
Keanu Reeves CodeForces - 1189A After playing Neo in the legendary "Matrix" trilogy, Keanu ...
- Codeforces Round #613 (Div. 2)(B-D)
Codeforces Round #613 (Div. 2) B -抢时间&手感生疏->(第n + 1次)被long long卡掉- C 又一次败给了常识-EC的M题也是一个关于素数的暴 ...
- Codeforces 1492D - Genius‘s Gambit (构造)
Codeforces Round #704 (Div. 2) D. Genius's Gambit 题意 要求构造出两个不包含前导0的二进制数字 x , y x,y x,y,满足: x , y x,y ...
- CodeForces 518A - Chewbaсca and Number(思路)
题意:给你两个长度相同的字符串,输出一个长度与它俩相同,且字典序位于两者之间(不可与其中一者相同)的字符串,若不存在则输出"No such string".(输入保证字典序第一个严 ...
最新文章
- AGX Xavier CAN调试
- spring 托管bean_在非托管对象中使用Spring托管Bean
- angular-JS模仿Form表单提交
- (转帖)eclipse 下 搭建 django开发环境
- C/C++语言可变参数表深层探索
- boost::sort模块实现spreadsort 键和数据排序示例
- Spring 核心容器类BeanDefinition
- 《 Docker 进阶与实战 》 读书笔记
- VMware vSAN分布式存储安装配置
- 我用Python又爬虫了拉钩招聘,给你们看看2019市场行情
- C# 创建文件夹 Directory
- 精通Hyperledger之Hyperledger composer建模语言(15)
- 163发送邮件服务器拒收,向网易163邮箱发信常见退信说明
- Oracle 12c PDB数据库的基本操作积累
- 什么是动态与静态IP
- 强大的dex反编译器
- 视频打包为MP4格式并存储到TF卡的实现
- Linux内核设计与实现 Robert Love
- 品读 泰戈尔 飞鸟集 之六 伤往昔
- Java Duration格式