当前位置:网站首页>Codeforces Round #643 (Div. 2)——B. Young Explorers
Codeforces Round #643 (Div. 2)——B. Young Explorers
2022-07-08 01:41:00 【Not long】
Topic link :https://codeforces.com/problemset/problem/1355/B
Title Description : Enter the explorer's experience level , When forming a team, the number of people in a team cannot be less than the experience level of any person in the team ( The number of people is greater than the highest experience level in the team ), It is required to form the largest number of teams .
Their thinking : greedy Choose people with low experience level to form a team that meets the conditions first .—— First sort by experience level from low to high , When the conditions are met, form a team .
Code :
#include<iostream>
#include<algorithm>
using namespace std;
int num[200005];
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> num[i];
sort(num, num + n);
int ans = 0, count = 0;
for (int i = 0; i < n; i++)
{
count++;
if (count >= num[i])
{
ans++;
count = 0;
}
}
cout << ans << endl;
}
return 0;
}
边栏推荐
- QT--创建QT程序
- 2022 safety officer-c certificate examination summary and safety officer-c certificate reexamination examination
- regular expression
- Introduction to natural language processing (NLP) based on transformers
- powerbuilder 中使用线程的方法
- NPDP在国内有认可度吗?看一看就明白了!
- Redis cluster
- NPM Internal Split module
- Matlab code on error analysis (MAE, MAPE, RMSE)
- Qml 字体使用pixelSize来自适应界面
猜你喜欢
About snake equation (1)
Kindle operation: transfer downloaded books and change book cover
2022 safety officer-c certificate examination summary and safety officer-c certificate reexamination examination
Redux使用
Tapdata 的 2.0 版 ,开源的 Live Data Platform 现已发布
云原生应用开发之 gRPC 入门
The examination contents of the third batch of Guangdong Provincial Safety Officer a certificate (main person in charge) in 2021 and the free examination questions of the third batch of Guangdong Prov
Redux usage
写一个纯手写的qt的hello world
2022 high voltage electrician examination skills and high voltage electrician reexamination examination
随机推荐
3. Multi agent reinforcement learning
从Starfish OS持续对SFO的通缩消耗,长远看SFO的价值
AttributeError: ‘str‘ object has no attribute ‘strftime‘
The examination contents of the third batch of Guangdong Provincial Safety Officer a certificate (main person in charge) in 2021 and the free examination questions of the third batch of Guangdong Prov
ROS problems (topic types do not match, topic datatype/md5sum not match, MSG XXX have changed. rerun cmake)
From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run
2021 welder (primary) examination skills and welder (primary) operation examination question bank
碳刷滑环在发电机中的作用
2022 examination for safety production management personnel of hazardous chemical production units and new version of examination questions for safety production management personnel of hazardous chem
批次管控如何实现?MES系统给您答案
小金额炒股,在手机上开户安全吗?
从cmath文件看名字是怎样被添加到命名空间std中的
Voice of users | understanding of gbase 8A database learning
Matlab code on error analysis (MAE, MAPE, RMSE)
不算不知道,花呗分期的真实利率居然这么高
break net
Understanding of prior probability, posterior probability and Bayesian formula
Anaconda3 tutorial on installing and adding Tsinghua image files
common commands
液压旋转接头的使用事项