ZOJ 3778 C - Talented Chef 水题
LINK:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3778
题意:有n道菜,每道菜需要\(a_i\)道工序,有m个锅可以同时做不同菜,问最小时间。
思路:水题,但要注意最小需要的时间显然是最大的\(a_i\)值,剩下的就是求个均,求个余的事了.
/** @Date : 2017-03-24-14.35
* @Author : Lweleth (SoungEarlf@gmail.com)
* @Link : https://github.com/
* @Version :
*/
#include<bits/stdc++.h>
#define LL long long
#define PII pair
#define MP(x, y) make_pair((x),(y))
#define fi first
#define se second
#define PB(x) push_back((x))
#define MMG(x) memset((x), -1,sizeof(x))
#define MMF(x) memset((x),0,sizeof(x))
#define MMI(x) memset((x), INF, sizeof(x))
using namespace std; const int INF = 0x3f3f3f3f;
const int N = 4e4+20;
const double eps = 1e-8; int a[N];
int main()
{
int T;
cin >> T;
while(T--)
{
int n, m;
LL sum = 0;
int ans = 0;
int ma = 0;
scanf("%d%d", &n, &m);
for(int i = 0; i < n; i++)
scanf("%d", a + i), sum += a[i], ma=max(ma, a[i]);
if(sum % m == 0)
ans = sum / m;
else ans = sum / m + 1;
if(ans < ma)
ans = ma;
printf("%d\n", ans);
}
return 0;
}
ZOJ 3778 C - Talented Chef 水题的更多相关文章
- ZOJ 3778:Talented Chef(贪心?思维)
Talented Chef Time Limit: 2 Seconds Memory Limit: 65536 KB As we all know, Coach Gao is a talented c ...
- Talented Chef(简单题,被我想的太复杂了,用复杂的方法当然会超时咯,由此可见,并非所有题都是想的越多越好)
Description As we all know, Coach Gao is a talented chef, because he is able to cook M dishes in the ...
- zoj 3778 Talented Chef(思维题)
题目 题意:一个人可以在一分钟同时进行m道菜的一个步骤,共有n道菜,每道菜各有xi个步骤,求做完的最短时间. 思路:一道很水的思维题, 根本不需要去 考虑模拟过程 以及先做那道菜(比赛的时候就是这么考 ...
- ZOJ 1494 Climbing Worm 数学水题
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=494 题目大意: 一只蜗牛要从爬上n英寸高的地方,他速度为u每分钟,他爬完u需要 ...
- zoj 3827 Information Entropy 【水题】
Information Entropy Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Information ...
- ZOJ 1796 Euchre Results 数学水题
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1796 题意: 四个人玩游戏,已知三个人的输赢情况,求第四个人的输赢情况. ...
- Talented Chef ZOJ - 3778
As we all know, Coach Gao is a talented chef, because he is able to cook M dishes in the same time. ...
- 水题 ZOJ 3875 Lunch Time
题目传送门 /* 水题:找排序找中间的价格,若有两个,选价格大的: 写的是有点搓:) */ #include <cstdio> #include <iostream> #inc ...
- 水题 ZOJ 3876 May Day Holiday
题目传送门 /* 水题:已知1928年1月1日是星期日,若是闰年加1,总天数对7取余判断就好了: */ #include <cstdio> #include <iostream> ...
随机推荐
- 个人作业四:注册github
注册Github账户 账户名称:liurunhan Github地址:https://github.com/liurunhan
- TensorFlow:NameError: name ‘input_data’ is not defined
在运行TensorFlow的MNIST实例时,第一步 import tensorflow.examples.tutorials.mnist.input_data mnist = input_data. ...
- 栈和队列在python中的实现
栈和队列是两种基本的数据结构,同为容器类型.两者根本的区别在于: stack:后进先出 queue:先进先出 PS:stack和queue是不能通过查询具体某一个位置的元素而进行操作的.但是他们的排列 ...
- Lucene 高级搜索
自定义评分 public class MyScoreQuery { public void searchByScoreQuery(){ try { IndexSearcher searcher=new ...
- caffe神经网络模型的绘图
Python/draw_net.py, 这个文件,就是用来绘制网络模型的.也就是将网络模型由prototxt变成一张图片. 1.安装GraphViz # sudo apt-get install Gr ...
- Destoon 模板存放规则 及 语法参考
模板存放规则及语法参考 一.模板存放及调用规则 模板存放于系统 template 目录,template 目录下的一个目录例如 template/default/ 即为一套模板 模板文件以 .htm ...
- 修改表中的enum字段
alter table 表名 modify 字段名 enum('system','audit','account','secadmin') DEFAULT NULL;
- webgl example1
<!doctype html> <html lang="en"> <head> <meta charset="utf-8&quo ...
- 按着shift键对dbgrid进行多条记录选择的问题(50分)
可以用sendmessage,想dbgrid 发键盘信息,按下shift键,同时按下button1procedure TForm1.Button1Click(Sender: TObject);vari ...
- Linux下修改环境变量PATH
1.什么是环境变量(PATH) 在Linux中,在执行命令时,系统会按照PATH的设置,去每个PATH定义的路径下搜索执行文件,先搜索到的文件先执行. 我们知道查阅文件属性的指令ls 完整文件名为:/ ...