hdu 5210 Delete
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=5210
简单题如下:
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstdio>
using std::sort;
const int Max_N = ;
int arr[Max_N];
int main() {
#ifdef LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w+", stdout);
#endif
int n, k, tot, ret, cnt;
while (~scanf("%d", &n)) {
tot = ;
for (int i = ; i < n; i++) scanf("%d", &arr[i]);
scanf("%d", &k);
sort(arr, arr + n);
for (int i = ; i < n;) {
ret = arr[i], cnt = ;
for (; ret == arr[i]; i++) cnt++;
tot++;
}
if (n - tot <= k) printf("%d\n", n - k);
else printf("%d\n", tot);
}
return ;
}
hdu 5210 Delete的更多相关文章
- hdu 5210 delete 水题
Delete Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5210 D ...
- BestCoder Round #39
-------好久没更新博客了,发现还是需要不断总结才能进步,所以还是把最近打的一些比赛记录一下. T1:Delete (hdu 5210) 题目大意: 给出n个数,然后要删掉k个,要求剩下的数中 不 ...
- HDU 1892 See you~ (二维树状数组)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1892 See you~ Problem Description Now I am leaving h ...
- HDU 5458 Stability(双连通分量+LCA+并查集+树状数组)(2015 ACM/ICPC Asia Regional Shenyang Online)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5458 Problem Description Given an undirected connecte ...
- hdu 3695:Computer Virus on Planet Pandora(AC自动机,入门题)
Computer Virus on Planet Pandora Time Limit: 6000/2000 MS (Java/Others) Memory Limit: 256000/1280 ...
- hdu 2177 取(2堆)石子游戏(威佐夫博奕)
题目链接:hdu 2177 这题不是普通的 Nim 博弈,我想它应该是另一种博弈吧,于是便推 sg 函数打了个 20*20 的表来看,为了方便看一些,我用颜色作了标记,打表代码如下: #include ...
- [题解]hdu 1009 FatMouse' Trade(贪心基础题)
Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding th ...
- hdu 3999 The order of a Tree (二叉搜索树)
/****************************************************************** 题目: The order of a Tree(hdu 3999 ...
- 数据结构--AC自动机--hdu 2896
病毒侵袭 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
随机推荐
- 【EF 4】ORM框架及其流行产品之一EF介绍
导读:跳进了多租户切换数据库的坑,那么就继续走下去吧.在我们的项目中,是运用EF实现对数据库的操作,那么EF其实是.NET系统中,基于ORM框架的一个产品实现.在java那边,则有Hibernate和 ...
- 使用VAssistX给文件和函数添加注释-2015.12.31
在Visual Studio使用VAssistX助手可以非常方便的给文件和函数添加注释,增加更多的记录信息,从而方便在时间久后,对代码阅读理解的提示,以及别人后续对代码的维护和BUG修改. 添加头文件 ...
- Razor视图引擎 语法
- hbase日常运维管用命令,region管理
1 Hbase日常运维 1.1 监控Hbase运行状况 1.1.1 操作系统 1.1.1.1 IO 群集网络IO,磁盘IO,HDFS IO IO越大说明文件读 ...
- PPTP --VPN配置
测试:1:根据上面的步骤4,在路由器里查看状态:2:手机热点,共享给你电脑,电脑拨号,进行测试. 参考:http://jingyan.baidu.com/article/90808022ddd6a ...
- Velocity原理
1.准备 添加引用:velocity-1.7.jar,velocity-tools-2.0.jar,commons-beanutils-1.7.0.jar,commons-chain-1.1.jar, ...
- FTP操作
using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Net ...
- iOS播放动态GIF图片
<转> 图片分为静态和动态两种,图片的格式有很多种,在开发中比较常见的是.png和.jpg的静态图片,但有的时候在App中需要播放动态图片,比如.gif格式的小表情头像,在IOS中并没有提 ...
- ASP.NET MVC SignalR(1):背景
系列目录:ASP.NET MVC SignalR 关键词:HTTP.轮询.WebSocket.Server-Sent Events.长轮询.forever frame. 1. HTTP HTTP(Hy ...
- 使用Spring开发第一个HelloWorld应用
http://www.importnew.com/13246.html 让我们用Spring来写第一个应用程序吧. 完成这一章要求: 熟悉Java语言 设置好Spring的环境 熟悉简单的Eclips ...