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 水题的更多相关文章

  1. ZOJ 3778:Talented Chef(贪心?思维)

    Talented Chef Time Limit: 2 Seconds Memory Limit: 65536 KB As we all know, Coach Gao is a talented c ...

  2. Talented Chef(简单题,被我想的太复杂了,用复杂的方法当然会超时咯,由此可见,并非所有题都是想的越多越好)

    Description As we all know, Coach Gao is a talented chef, because he is able to cook M dishes in the ...

  3. zoj 3778 Talented Chef(思维题)

    题目 题意:一个人可以在一分钟同时进行m道菜的一个步骤,共有n道菜,每道菜各有xi个步骤,求做完的最短时间. 思路:一道很水的思维题, 根本不需要去 考虑模拟过程 以及先做那道菜(比赛的时候就是这么考 ...

  4. ZOJ 1494 Climbing Worm 数学水题

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=494 题目大意: 一只蜗牛要从爬上n英寸高的地方,他速度为u每分钟,他爬完u需要 ...

  5. zoj 3827 Information Entropy 【水题】

    Information Entropy Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge Information ...

  6. ZOJ 1796 Euchre Results 数学水题

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1796 题意: 四个人玩游戏,已知三个人的输赢情况,求第四个人的输赢情况. ...

  7. 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. ...

  8. 水题 ZOJ 3875 Lunch Time

    题目传送门 /* 水题:找排序找中间的价格,若有两个,选价格大的: 写的是有点搓:) */ #include <cstdio> #include <iostream> #inc ...

  9. 水题 ZOJ 3876 May Day Holiday

    题目传送门 /* 水题:已知1928年1月1日是星期日,若是闰年加1,总天数对7取余判断就好了: */ #include <cstdio> #include <iostream> ...

随机推荐

  1. Android开发第二阶段(5)

    今天:对图片的替换修改,使整个app的图案化更美观. 明天:对Android的对sdcard的操作学习

  2. 福大软工1816 - 404 Note Found选题报告

    目录 NABCD分析引用 N(Need,需求): A(Approach,做法): B(Benefit,好处): C(Competitors,竞争): D(Delivery,交付): 初期 中期 个人贡 ...

  3. 不要USB数据线调试Android开发

    不管是过去Eclipse还是现在的Android Studio开发Android,运行或者调试时都会利用USB数据线连接电脑和手机,特别是当现在的手机只有一个Type-c接口,意味着,插上后,啥也干不 ...

  4. linux设置时区和自动同步时间

    1.设置时区 编辑 /etc/sysconfig/clock 修改 ZONE="Asia/Shanghai" 然后  cp  /usr/share/zoneinfo/Asia/Sh ...

  5. java 基础 --Collection(Set)

    注意: 如果hashSet存储自定义对象,一定要重写hashCode()&&equals() 如果TreeSet存储自定义对象,让元素所属的类实现自然排序接口Comparable,并重 ...

  6. TCP建立连接与释放连接过程中的几个问题

    TCP为何采用三次握手来建立连接,若采用两次握手可以吗,请说明理由? 不可以.采用三次握手是为了防止失效的连接请求报文段突然又传送到服务器,从而发生错误.当客户端发出的连接请求报文段由于某些原因没有及 ...

  7. angularjs 指令间相互调用

    <div ng-app="app"> <div ng-controller="myctl"> <button superman s ...

  8. 洛谷 P2057 善意的投票(网络流最小割)

    P2057 善意的投票 题目描述 幼儿园里有n个小朋友打算通过投票来决定睡不睡午觉.对他们来说,这个问题并不是很重要,于是他们决定发扬谦让精神.虽然每个人都有自己的主见,但是为了照顾一下自己朋友的想法 ...

  9. [JSOI2009]游戏 二分图博弈

    题面 题面 题解 二分图博弈的模板题,只要会二分图博弈就可以做了,可以当做板子打. 根据二分图博弈,如果一个点x在某种方案中不属于最大匹配,那么这是一个先手必败点. 因为对方先手,因此我们就是要找这样 ...

  10. 【51Nod1258】序列求和V4(FFT)

    [51Nod1258]序列求和V4(FFT) 题面 51Nod 多组数据,求: \[Ans=\sum_{i=1}^ni^k,n\le 10^{18},k\le50000\] 题解 预处理伯努利数,时间 ...