2019 GDUT Rating Contest III : Problem D. Lemonade Line
题面:
D. Lemonade Line
Farmer John wants to prepare some amount of lemonade in advance, but he does not want to be wasteful. The number of cows who join the line might depend on the order in which they arrive. Help him find the minimum possible number of cows who join the line.
题目描述:
题目分析:







1 #include <cstdio>
2 #include <cstring>
3 #include <iostream>
4 using namespace std;
5 const int maxn = 1e5+5;
6 int w[maxn];
7 int cnt;
8
9 bool cmp(int a, int b){
10 return a > b;
11 }
12
13 int main(){
14 int n;
15 scanf("%d", &n);
16 for(int i = 0; i < n; i++){
17 scanf("%d", &w[i]);
18 }
19
20 sort(w, w+n, cmp); //排序
21
22 cnt = 0;
23 for(int i = 0; i < n; i++){
24 if(cnt <= w[i]){ //能排就排队
25 cnt++;
26 }
27 }
28
29 cout << top << endl;
30 return 0;
31 }
2019 GDUT Rating Contest III : Problem D. Lemonade Line的更多相关文章
- 2019 GDUT Rating Contest III : Problem E. Family Tree
题面: E. Family Tree Input file: standard input Output file: standard output Time limit: 1 second Memory ...
- 2019 GDUT Rating Contest III : Problem C. Team Tic Tac Toe
题面: C. Team Tic Tac Toe Input file: standard input Output file: standard output Time limit: 1 second M ...
- 2019 GDUT Rating Contest III : Problem A. Out of Sorts
题面: 传送门 A. Out of Sorts Input file: standard input Output file: standard output Time limit: 1 second M ...
- 2019 GDUT Rating Contest II : Problem F. Teleportation
题面: Problem F. Teleportation Input file: standard input Output file: standard output Time limit: 15 se ...
- 2019 GDUT Rating Contest I : Problem H. Mixing Milk
题面: H. Mixing Milk Input file: standard input Output file: standard output Time limit: 1 second Memory ...
- 2019 GDUT Rating Contest I : Problem A. The Bucket List
题面: A. The Bucket List Input file: standard input Output file: standard output Time limit: 1 second Me ...
- 2019 GDUT Rating Contest I : Problem G. Back and Forth
题面: G. Back and Forth Input file: standard input Output file: standard output Time limit: 1 second Mem ...
- 2019 GDUT Rating Contest II : Problem G. Snow Boots
题面: G. Snow Boots Input file: standard input Output file: standard output Time limit: 1 second Memory ...
- 2019 GDUT Rating Contest II : Problem C. Rest Stops
题面: C. Rest Stops Input file: standard input Output file: standard output Time limit: 1 second Memory ...
随机推荐
- 在QT C++中调用 Python并将软件打包发布(裸机可运行)
为了提高工作效率,需要一个可以自动生成多份相关联的word文档免去繁琐复制粘贴工作的软件.最后选定使用QT C++做界面和主要逻辑程序设计,对word的操作使用python写好对应的函数,然后在QT中 ...
- CodeForces 348D Turtles(LGV定理)题解
题意:两只乌龟从1 1走到n m,只能走没有'#'的位置,问你两只乌龟走的时候不见面的路径走法有几种 思路:LGV定理模板.但是定理中只能从n个不同起点走向n个不同终点,那么需要转化.显然必有一只从1 ...
- five86-1 (OpenNetadmin RCE+cp命令提权+crunch生成密码字典)
Vulnhub-Five86-1 实验环境 kali攻击机ip:192.168.56.116 Five86-1靶机ip:192.168.56.121 知识点及工具 nmap扫描 john爆破 Open ...
- C语言中函数的调用方式
第一眼看到这样一个题目的我,心想除了如下的直接调用还能怎么调用呢? 1 void fun(void) 2 { 3 ...... 4 //你的代码 5 ..... 6 } 7 int main(void ...
- HBuilderX All In One
HBuilderX All In One uni-app https://uniapp.dcloud.io/quickstart-hx 目录结构 一个uni-app工程,默认包含如下目录及文件: $ ...
- VSCode 在 Vue 导入路径中使用 @ 符号后无法正确跳转 bug
VSCode 在 Vue 导入路径中使用 @ 符号后无法正确跳转 bug bug jsconfig.json { // This file is required for VSCode to unde ...
- webpack 性能优化 dll 分包
webpack 性能优化 dll 分包 html-webpack-externals-plugin DLLPlugin https://www.webpackjs.com/configuration/ ...
- React Native & Security
React Native & Security https://reactnative.dev/docs/security React Native blogs https://reactna ...
- clientHeight & offsetHeight & scrollHeight
clientHeight & offsetHeight & scrollHeight scrollWidth/scrollHeight,offsetWidth/offsetHeight ...
- SPC空投火爆来袭!区块链技术落地加速!
经历市场狂热后,区块链逐渐恢复合理性,在政策红利.技术等多力推进下,各行各业开始涌入区块链行业.在这波浪潮中,SPC侧链代币项目显得格外亮眼,其空投已经发放至第二轮,仅SPC空投月收益就达23%左右, ...