#include using namespace std; int main () { for (int n=4; n>=0; n--) { int a1,a2,a3,b1,b2,b3,c3,d3,S; cout << "Enter the number of boxes in the first row at a partition> "; cin >> a1; cout << "Enter the number of boxes in the second row at a partition> "; cin >> a2; cout << "Enter the number of boxes in the third row at a partition> "; cin >> a3; cout << "Enter the number of boxes in the first row at another partition> "; cin >> b1; cout << "Enter the number of boxes in the second row at another partition> "; cin >> b2; cout << "Enter the number of boxes in the third row at another partition> "; cin >> b3; S=0; for (int c1=b1; c1>=0; c1--) { for (int c2=b1-c1; c2>=0; c2--) { if (a2+c2<=a1) {c3=b1-c1-c2; if (a3+c3<=a2) { for (int d2=b2; d2>=0; d2--) { if (a1+c1>=a2+c2+d2) {d3=b2-d2; if (a2+c2>=a3+c3+d3) { if (a2+c2+d2 >= a3+c3+d3+b3) {if (d2>=b3) { if (c1>=d2) { if (c1+c2>=d2+d3) { cout << a1+c1 << a2+c2+d2 << a3+c3+d3+b3 << " dim=" << (a1+c1+2-a3-c3-d3-b3)*(a1+c1+1-a2-c2-d2)*(a2+c2+d2+1-a3-c3-d3-b3)/2 << " "; S=S+(a1+c1+2-a3-c3-d3-b3)*(a1+c1+1-a2-c2-d2)*(a2+c2+d2+1-a3-c3-d3-b3)/2;}}}}}}}} } } } cout << " total dim=" << S << " "; } return 0; }