Result: Accepted
Time: 8ms
Memory: 1120kB
#include<stdio.h>
int max(int x, int y) {
if(x <= y) return y;
if(y < x) return x;
}
int main() {
int a,b,c,d,e;
while(scanf("%d%d%d%d%d",&a,&b,&c,&d,&e) != EOF) {
int V1,V2,V3,V4;
if(d<e) {
V1= (a - 2*e) * (c - 2*e) *d;
V2= (a - 2*e) * (b - 2*e) *d;
V3= (b - 2*e) * (c - 2*e) *d;
V4= a * b * c - 2 * V1 - 2 * V2 - 2 * V3;
}
else{
V1=(a-2*d)*(b-2*d)*(c-2*d);
V2 = 4*(a-2*e)*e*e+4*(b-2*e)*e*e+4*(c-2*e)*e*e+8*e*e*e;
V4=max(V1,V2);
}
printf("%d\n",V4);
}
return 0;
}