分组训练2

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3776

第一题:很简单,但是还是WA了一次,以为粘贴复制省事,忘了改一个变量;所以卒;

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3782

我们做的第二题,翻译错了题意,以为是输入字符串,想得太复杂了,浪费了太多的时间,最后队友很快打完了,才知道不是字符串,心累;

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3787

做的第三题,没什么好说的,基本上一样的代码,队友没过,我却过了,很伤;

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3778

第四题:想法题,队友过的; 

4: #include <cstdio>

#include <cstring>
int main()
{
 int t;
 int n,m;
 while(~scanf("%d",&t))
 {
  while(t--)
  {
   int di;
   int ma=0;
   int sum=0;
   scanf("%d%d",&n,&m);
   int i;
   for(i=0;i<n;i++)
   {
    scanf("%d",&di);
    if(ma<di)
    {
     ma=di;
    }
    sum+=di;
   }
   int ans=sum/m;
   if(sum%m)
   {
    ans++;
    
   }
   if(ans<ma)
   {
    ans=ma;
   }
   printf("%d\n",ans);
  }
 }
 return 0;
}

 

posted @ 2017-05-03 22:58  亓天大圣  阅读(115)  评论(0编辑  收藏  举报