题目链接

题意 : 这个人需要做n道菜,每道菜Ai步,他可以同时做M道不同的菜的其中一步,问你最少需要多少时间能做完所有的菜。

思路 : 这个题比赛的时候禁锢思路了,根本没想出来,就是当M > N时,需要的时间一定是N道菜里边步骤最多的那道菜的步骤数。如果不是就判断平均需要的时间,如果平均需要的时间不如最多步骤多,那还是步骤数,否则就是平均时间。

 #include <iostream>
#include <stdio.h>
#include <string.h> using namespace std; int a[] ; int main()
{
int n,t,m ;
scanf("%d",&t);
while(t--)
{
scanf("%d %d",&n,&m) ;
int sum = ;
int maxx = ;
for(int i = ; i <= n ; i++)
{
scanf("%d",&a[i]) ;
sum += a[i] ;
maxx = max(maxx,a[i]) ;
}
int temp = sum/m ;
if(sum % m)
temp++ ;
if(temp <= maxx)
temp = maxx ;
printf("%lld\n",temp) ;
}
return ;
}

ZOJ 3778 Talented Chef的更多相关文章

  1. ZOJ 3778 Talented Chef(找规律,模拟计算,11届ACM省赛,简单)

    题目链接 2014年浙江省赛C题,当时觉得难,现在想想这题真水.. 找规律: 若   最大的那个步骤数*m-总和>=0,那么答案就是 最大的那个步骤数 . 否则  就要另加上不够的数量,具体看代 ...

  2. zoj 3778 Talented Chef(思维题)

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

  3. ZOJ 3778 Talented Chef 模拟 [ 祝愿明天省赛一帆风顺, ZJSU_Bloom WILL WIN : )

    这题的意思是给你 n 道菜,第 i 道菜需要 Ai 步才能完成 每次你能对 m 道菜分别完成一步,请问最少需要几次? 这题暴力写肯定是不行的,去年省赛的时候就是没写出来这题,今天再把思路理一理吧. 首 ...

  4. ZOJ 3778 Talented Chief

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3778 题目 某人做菜很厉害,一分钟能同时完成最多m个菜的一道工序,输入菜的 ...

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

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

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

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

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

  8. zoj3778 Talented Chef

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

  9. ZOJ 3778 C - Talented Chef 水题

    LINK:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3778 题意:有n道菜,每道菜需要\(a_i\)道工序,有m个锅可 ...

随机推荐

  1. <转载>提升程序的特权(AdjustTokenPrivileges)

    首先列出需要的函数 1.OpenProcessToken 2.AdjustTokenPrivileges 3. LookupPrivilegeValue ----------------------- ...

  2. ios Swift 国外资源

    Swift国外资源汇总(No.1) 此类分享贴暂定每2天更新一次,主要目的是让大家能跟国外开发者们同步,共享知识和共同提高. 对于一些非常有价值的文章,大家有兴趣可以自行翻译(回贴跟我说一声,避免重复 ...

  3. SharePoint Server 2013介绍v2

    SharePoint Server 2013介绍v2 http://wenku.baidu.com/link?url=rNYYoDmHcXmqhzOeA1sln5cS2xcnABYycBuz8Z4Oq ...

  4. c# using 引用和别名的使用

    1.使用别名 在同时引用的两个命名空间中有相同的类型时,可以使用别名来区分.如下所示: using System; using System.Threading; using System.Timer ...

  5. SOA 的基本概念及设计原则浅议

    SOA是英文词语"Service Oriented Architecture"的缩写,中文有多种翻译,如"面向服务的体系结构"."以服务为中心的体系结 ...

  6. dorado7 重装了tomcat后配置路径

    在Windows->Preferences->Server->Runtime Environments把先前的工程Servers删除掉

  7. PerformSelector may cause a leak because its selector is unknown 解决方法

    我的技术博客经常被流氓网站恶意爬取转载.请移步原文:http://www.cnblogs.com/hamhog/p/3801030.html,享受整齐的排版.有效的链接.正确的代码缩进.更好的阅读体验 ...

  8. Poj 3062 Celebrity jeopardy

    1.Link: http://poj.org/problem?id=3062 2.Content: Celebrity jeopardy Time Limit: 1000MS   Memory Lim ...

  9. Winform 异步更新listbox

    public partial class Form1 : Form { private BackgroundWorker bw; public Form1() { InitializeComponen ...

  10. linux下获得块设备大小

    运行结果如下 jackie@Ubuntu:~/work/0602$ sudo ./a.out /dev/sda/dev/sda3907029168,2000398934016 //BLKGETSIZE ...