Start: Jul, 01, 2019 08:30:00
2019年度暑期短学期第四天
End: Jul, 01, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: A
Result: Accepted
Time: 7ms
Memory: 1120kB
Author: 2018212212167
In contest: 1277

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
int main()
{	
	int a,b,c,d,e;
	int v1,v2,v3;
	while(scanf("%d%d%d%d%d",&a,&b,&c,&d,&e)!=EOF)
	{
		v1=a*b*c;
		if(d<e)
		{
		v2=2*d*(a-2*e)*(b-2*e)+2*d*(a-2*e)*(c-2*e)+2*d*(b-2*e)*(c-2*e);
		printf("%d\n",v1-v2);	
		}
		else if(2*d>=a||2*d>=b||2*d>=c)
		{
			v2=(a-2*e)*(b-2*e)*(c-2*e)+2*e*(a-2*e)*(b-2*e)+2*e*(a-2*e)*(c-2*e)+2*e*(b-2*e)*(c-2*e);
			printf("%d\n",v1-v2);
			}
		else
		{
			v3=(a-2*e)*(b-2*e)*(c-2*e)+2*e*(a-2*e)*(b-2*e)+2*e*(a-2*e)*(c-2*e)+2*e*(b-2*e)*(c-2*e);
			v2=(a-2*d)*(b-2*d)*(c-2*d);
			if(v2>(v1-v3))
			{
				printf("%d\n",v2);
			}
			else
			{
				printf("%d\n",v1-v3);
			}
			}	
	}
	return 0;
}