// Boxes.cc // ECNA 2012 #include using namespace std; #define IFDB if(DEBUG) #define FOR(i,n) for(int i=0;i0){ FOR(pos,3){ //try all 3 positions of box k if(WillFit(Boxes[LastBox].w[LastPos], Boxes[LastBox].l[LastPos], Boxes[k].w[pos], Boxes[k].l[pos])) //box k will fit on top { X[i].box=k; X[i].pos=pos; if (tallest>n; while(n>0){ FOR(i,n) { //get dim of boxes cin>>a>>b>>c; Boxes[i].w[1]=Boxes[i].w[0]=a; Boxes[i].l[0]=Boxes[i].w[2]=b; Boxes[i].l[1]=Boxes[i].l[2]=c; } //now make width < length FOR(i,n){ FOR(j,3){ if(Boxes[i].w[j]>Boxes[i].l[j]) Swap(Boxes[i].w[j], Boxes[i].l[j]); } } IFDB PrintBoxes(); tallest = 0; BT(0); cout<<"Case "<>n; } return 0; }