Start: Jun, 28, 2019 13:00:00
2019年度暑期短学期第四天-助教场
End: Jun, 30, 2019 23:59:00
Time elapsed:
Time remaining:

Problem_ID: A
Result: Accepted
Time: 10ms
Memory: 1092kB
Author: 2018212212029
In contest: 1289

#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main() {
	int a,b,c,d,e,v1,v2;
	int s1,s2,s3,s4;
	while(~scanf("%d%d%d%d%d",&a,&b,&c,&d,&e)) {
		if(d<e) {
			s1=(c-2*e)*(a-2*e)*d;
			s2=(c-2*e)*(b-2*e)*d;
			s4=(a-2*e)*(b-2*e)*d;
			s3=(a*b*c)-2*s1-2*s2-2*s4;
			printf("%d\n",s3);
		} else {
			v1=a*e*e*4+(b-2*e)*e*e*4+(c-2*e)*e*e*4;
			v2=(a-2*d)*(b-2*d)*(c-2*d);
			if(v2<0)v2=0;
			if(v1>=v2)printf("%d\n",v1);
			if(v1<v2)printf("%d\n",v2);

		}
	}

}