#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define ll long long
#define rep(i,j,k) for(long long i=j;i<=k;i++)
#define per(i,j,k) for(long long i=j;i>=k;i--)
using namespace std;
const int N = 2e5+;
ll h[N];
int main(){
long long n,k;
while(~scanf("%lld%lld",&n,&k)){
memset(h,,sizeof(h));
ll maxx=;
ll x;
ll minn=2e5+;
for (int i=;i<=n;i++){
scanf("%lld",&x);
h[x]++;
minn=min(minn,x);
maxx=max(maxx,x);
}
ll sum=;
per(i,maxx-,minn)
h[i]=h[i+]+h[i];
int cnt=;
// cout<<endl;
// rep(i,minn,maxx){
// printf("%d ",h[i]);
// }
// cout<<endl;
per(i,maxx,minn){
if (h[i]+sum>k){
cnt++;
sum=h[i];
}else{
sum=sum+h[i];
}
}
if (sum>h[minn]){
cnt++;
}
printf("%d\n",cnt);
}
return ;
}

Educational Codeforces Round 52 (Rated for Div. 2) -C的更多相关文章

  1. Educational Codeforces Round 52 (Rated for Div. 2) E. Side Transmutations

    http://codeforces.com/contest/1065/problem/E 数学推导题 #include <bits/stdc++.h> using namespace st ...

  2. Educational Codeforces Round 52 (Rated for Div. 2)

    题目链接 A. Vasya and Chocolate 题意 已知钱,价格,赠送规则求最多获得巧克力数 思路常规算即可 代码 #include <bits/stdc++.h> #defin ...

  3. Educational Codeforces Round 52 (Rated for Div. 2) F. Up and Down the Tree 树型DP

    题面 题意:给你一棵树,你起点在1,1也是根节点,你每次可以选择去你子树的某个叶子节点,也可以选择,从叶子节点返回距离不超过k的一个根, 也就是说,你从1开始,向下跳,选择一个叶子(就是没有子树的节点 ...

  4. Educational Codeforces Round 117 (Rated for Div. 2)

    Educational Codeforces Round 117 (Rated for Div. 2) A. Distance https://codeforces.com/contest/1612/ ...

  5. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

  6. Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...

  7. Educational Codeforces Round 43 (Rated for Div. 2)

    Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...

  8. Educational Codeforces Round 35 (Rated for Div. 2)

    Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...

  9. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...

随机推荐

  1. sql 语句按字段指定值排序及分页

    为特定字段赋值并排序 表[Table_temp]中列[col1]为字符,属性为varchar(),排序时需要按照B.A.C的顺序显示,则可按照以下SQL语句: select * from Table_ ...

  2. python连接sqlserver数据库

    1.准备工作 python3.6连接sqlserver数据库需要引入pymssql模块 pymssql官方:https://pypi.org/project/pymssql/ 没有安装的话需要: pi ...

  3. mysql文件

    MySQL的每个数据库都对应存放在一个与数据库同名的文件夹中,MySQL数据库文件包括MySQL(server)所建数据库文件和MySQL(server)所用存储引擎创建的数据库文件. .frm文件: ...

  4. Apache中httpd.conf文件的详解

    PHP中,Apache的配置至关重要,特别是httpd.conf这个文件,它是Apache中的核心文件.好了,废话不说,今天将这个文件中的一些内容讲解一番. ServerRoot "d:/w ...

  5. 持续代码质量管理-SonarQube-7.3部署

    Sonar 是一个用于代码质量管理的开放平台.通过插件机制,Sonar 可以集成不同的测试工具,代码分析工具,以及持续集成工具.与持续集成工具(例如 Hudson/Jenkins 等)不同,Sonar ...

  6. 基于WIN8.1:新手篇→tomcat安装配置

    一.JDK配置 下载安装JDK和tomcat 打开电脑属性,高级系统设置进行环境变量配置 新建系统变量,变量值为JDK安装路径,并在系统变量path最后加上“%JAVA_HOME%\bin;%JAVA ...

  7. M码小黄衫买家秀=w=

    M码小黄衫买家秀=w= 17°的天气穿不了短袖polo..就只能这样强行上图啦~ 因为我一直耿耿于大一面向对象课上拿到的那件XL码小黄衫,长到能穿到膝盖,拍小黄衫全家福时候只能很凄凉的借了件小号的穿, ...

  8. jdk旧版本下载

    如何找到旧版本的jdk: 1.去oracle官网关于下载jdk的这一板块,https://www.oracle.com/technetwork/java/javase/downloads/index. ...

  9. U盘插入电脑3.0的口没有反应了,2.0的口就可以

    如果驱动没有问题的话,很有可能是优盘硬件故障. 尝试解决办法: 1.使劲插(就是用力一插到底).... 2.插入三分之一,不过速度只能达到2.0的速度.

  10. TOPWAY智能彩色TFT液晶显示模块

    TOPWAY 20年来专注工业显示, 以为全球工业用户提供稳定可靠和容易使用的液晶显示模块为己任, 智能彩色TFT液晶显示模块(以下简称智能模块), 就是我们在容易使用TFT 彩色液晶显示方向上为广大 ...