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 ...
随机推荐
- Leetcode(82)-删除排序链表中的重复元素 II
给定一个排序链表,删除所有含有重复数字的节点,只保留原始链表中 没有重复出现 的数字. 示例 1: 输入: 1->2->3->3->4->4->5 输出: 1-&g ...
- uni-app 实战-打包 📦 App
uni-app 实战-打包 App Android & iOS 证书 广告 refs xgqfrms 2012-2020 www.cnblogs.com 发布文章使用:只允许注册用户才可以访问 ...
- MOOC学习成果认证及对高等教育变革路径的影响
MOOC是网络开放教育创新发展的产物,也是备受人们欢迎的网络学习途径.当前制约MOOC能否可持续深入发展的问题聚焦于MOOC学习成果能否得到合理的认证.MOOC学习成果认证分为非学分认证和学分认证.M ...
- free video tutorial of Deep Learning
free video tutorial of Deep Learning AI 深度学习/ 机器学习/人工智能 Deep Learning With Deep Learning – a form of ...
- Apple Watch Series 6 全天候视网膜显示屏和全天候高度计是什么鬼
Apple Watch Series 6 全天候视网膜显示屏和全天候高度计是什么鬼 Apple Watch Series 6 / Apple Watch Series 5 全天候视网膜显示屏 LTPO ...
- node.js 中间件
node.js 中间件 node.js middleware Express middleware body-parser cookie-parser cookie-session cors csur ...
- html5 & iOS
html5 & iOS Apple App Store审核指南 https://developer.apple.com/app-store/review/guidelines/ Apple审核 ...
- git in depth
git in depth git delete remote branch # Deleting remote branches in Git $ git push origin --delete f ...
- MacBook Pro 2019 13 inch & screen blink
MacBook Pro 2019 13 inch & screen blink MacBook Pro 闪屏 https://macreports.com/mac-how-to-trouble ...
- windows10 WSL
搭建WSL linux下的home目录,映射windows的目录地址 用户家目录 ➜ ~ pwd /home/ajanuw C:\Users\ajanuw\AppData\Local\Packages ...