HZAU 1209 Deadline (技巧)
来源:互联网 发布:索信达数据 编辑:程序博客网 时间:2024/06/05 10:30
Description
There are N bugs to be repaired and some engineers whose abilities are roughly equal. And an engineer can repair a bug per day. Each bug has a deadline A[i].
Question: How many engineers can repair all bugs before those deadlines at least?
1<=n<= 1e6. 1<=a[i] <=1e9
Input Description
There are multiply test cases.
In each case, the first line is an integer N , indicates the number of bugs.
The next line is n integers indicates the deadlines of those bugs.
Output Description
There are one number indicates the answer to the question in a line for each case.
Input
41 2 3 4
Output
1
题意
程序员一天可以修改一个 bug
,现在给你一些 bug
以及其修复期限,问最少需要多少个程序员才可以完成任务。
思路
首先因为 bug
。
假如每一个 bug
找一个程序员来改,那么总共最多有 bug
我们不用考虑,因为它总能被修复。
对于前 bug
,我们把它在
AC 代码
#include <stdio.h>#include <string.h>#include <stdlib.h>#include <iostream>using namespace std;int a[1000009];const int maxn = 1e6;int main(){ int n,b; while(~scanf("%d",&n)) { memset(a,0,sizeof(a)); for(int i=1; i<=n; i++) { scanf("%d",&b); if(b<=maxn)a[b]++; } int sum=0,ans=1; for(int i=1; i<=maxn; i++) { sum+=a[i]; int t=((sum-1)/i+1); ans=max(ans,t); } printf("%d\n",ans); } return 0;}
- HZAU 1209 Deadline (技巧)
- hzau 1209 Deadline 思维@
- HZAU 1209 Deadline
- HZAU 1209 Deadline (hash 贪心 水题不水)
- Deadline
- HZAU oj 1015(LCS)
- 最后期限(THE DEADLINE)
- HZAU校赛F题 LCS (dp)
- HZAU--21--Arithmetic Sequence(二维dp)
- HZAU--20--Catching Dogs(模拟)
- HZAU--19--Eat Candy(水题)
- HZAU 1208 Color Circle (dfs)
- HZAU 1201 Friends(树形dp)
- HZAU 1097 Yuchang and Zixiang ‘s maze (BFS)
- HZAU 1199 Little Red Riding Hood (dp)
- HZAU 1202 GCD (矩阵快速幂 + GCD)
- HZAU 1199 Little Red Riding Hood(水DP)
- HZAU 1201 Friends(树形DP 待整理)
- 设计模式学习之访问者模式
- 数组排序的常见方法
- 使用原生态jdbc查询mysql数据库中用户表的记录
- notepad++ 操作实例
- label的用法
- HZAU 1209 Deadline (技巧)
- learning python in the hard way习题6~10的附加题练习
- java操作图片生成水印
- jdk源码解读-并发包-Lock-ReentrantLock(1)--lock()与unlock()方法走读
- 【70】Climbing Stairs
- 信号---信号的阻塞
- 四、用servlet类返回WEB-INF中的页面
- 像“钢铁侠”埃隆·马斯克那样,成为超速学习者
- 变量、作用域和内存问题