当前位置:网站首页>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;
}
边栏推荐
- 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
- Codeforces Round #649 (Div. 2)——A. XXXXX
- 2022 refrigeration and air conditioning equipment operation examination questions and refrigeration and air conditioning equipment operation examination skills
- 5、離散控制與連續控制
- After modifying the background of jupyter notebook and adding jupyterthemes, enter 'JT -l' and the error 'JT' is not an internal or external command, nor a runnable program
- 用户之声 | 冬去春来,静待花开 ——浅谈GBase 8a学习感悟
- Gbase observation | how to protect the security of information system with frequent data leakage
- 如果时间是条河
- How does Matplotlib and PIL image integrate and save multiple pictures into one picture
- Leetcode exercise - Sword finger offer 36 Binary search tree and bidirectional linked list
猜你喜欢

Anaconda3 download address Tsinghua University open source software mirror station

图解网络:揭开TCP四次挥手背后的原理,结合男女朋友分手的例子,通俗易懂

2022 safety officer-b certificate examination question bank and safety officer-b certificate simulation test questions

qt--将程序打包--不要安装qt-可以直接运行

2022 high voltage electrician examination skills and high voltage electrician reexamination examination

Matlab code about cosine similarity

2021-03-06 - play with the application of reflection in the framework

2022 high altitude installation, maintenance and demolition examination materials and high altitude installation, maintenance and demolition operation certificate examination

Redis master-slave replication

The solution of frame dropping problem in gnuradio OFDM operation
随机推荐
2022 R1 fast opening pressure vessel operation test question bank and R1 fast opening pressure vessel operation free test questions
NPM internal split module
Urban land use distribution data / urban functional zoning distribution data / urban POI points of interest / vegetation type distribution
Call (import) in Jupiter notebook ipynb . Py file
pb9.0 insert ole control 错误的修复工具
npm 内部拆分模块
Gnuradio transmits video and displays it in real time using VLC
液压旋转接头的使用事项
Version 2.0 de tapdata, Open Source Live Data Platform est maintenant disponible
Capability contribution three solutions of gbase were selected into the "financial information innovation ecological laboratory - financial information innovation solutions (the first batch)"
写一个纯手写的qt的hello world
The persistence mode of redis - RDB and AOF persistence mechanisms
How does Matplotlib and PIL image integrate and save multiple pictures into one picture
Chapter 7 behavior level modeling
Is it safe to open an account on your mobile phone for small amount of stock speculation?
Usage of xcolor color in latex
The foreach map in JS cannot jump out of the loop problem and whether foreach will modify the original array
ROS 问题(topic types do not match、topic datatype/md5sum not match、msg xxx have changed. rerun cmake)
城市土地利用分布数据/城市功能区划分布数据/城市poi感兴趣点/植被类型分布
MATLAB R2021b 安装libsvm