码迷,mamicode.com
首页 > 其他好文 > 详细

Codeforces 450 C. Jzzhu and Chocolate

时间:2014-07-20 22:27:13      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:codeforces

//area=(n*m)/ ((x+1)*(k-x+1)) 
//1: x==0;
//2: x=n-1
//3: x=m-1
# include <stdio.h>
long long max(long long x,long long y)
{
	return x>y?x:y;
}
int main()
{
	long long  n,m,k,sum,t,ans;
	scanf("%lld%lld%lld",&n,&m,&k);
	sum=n+m-2;
	if(k>sum)
		printf("-1\n");
	else if(sum==k)
		printf("1\n");
	else
	{
		ans=0;
		if(n>=k+1)//x=0
		{
			ans=max(ans,m*(n/(k+1)));
		}
		else//x=n-1
		{
			t=k-n+2;
			ans=max(ans,m/t);
		}
		if(m>=k+1)//x=0
		{
			ans=max(ans,n*(m/(k+1)));
		}
		else//x=m-1
		{
			t=k-m+2;
			ans=max(ans,n/t);
		}
		printf("%lld\n",ans);
	}
	return 0;
}

Codeforces 450 C. Jzzhu and Chocolate

标签:codeforces

原文地址:http://blog.csdn.net/lp_opai/article/details/37995107

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!