Codeforces 450 C. Jzzhu and Chocolate

时间:2022-01-29 14:42:50
//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;
}

版权声明:本文博主原创文章,博客,未经同意不得转载。