View Code of Problem 615

#include<stdio.h>
int main()
{
	int i,j,count,t,n,k=1,a,max;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		count =0;max=0;
		for(i=0;i<n;i++)
		{
			scanf("%d",&a);
			count+=a;
			max=a>max?a:max;
		}
		if(count%2==0)
		{
			count/=2;
		}
		else if(count%2==1)
		{
			count=count/2+1;
		}
		count=max>count?max:count;	
		printf("Case #%d: %d\n",k++,count);
	}
	return 0;
 }

Double click to view unformatted code.


Back to problem 615