//2008E Scott #include using namespace std; class Box { public: Box(int box[]); int Width() { return size[0]; }; int Length() {return size[1]; }; int Height() {return size[2]; }; bool operator= (Box & other) const; bool operator< (Box & other) const; private: int size[3]; // 0 = width, 1 = length, 2 = height }; Box::Box(int box[]) { size[0] = box[4] - box[1]; size[1] = box[3] - box[6]; size[2] = box[14] - box[2]; int tmp; for (int i = 0; i < 3; i++) { for (int j = i; j < 3; j++ ) { if (size[j] < size[i]) { tmp = size[j]; size[j] = size[i]; size[i] = tmp; } } } } bool Box::operator= (Box & other) const { if ( size[0] == other.Width() && size[1] == other.Length() && size[2] == other.Height()) return true; else return false; } bool Box::operator< (Box & other) const { if ( size[0] < other.Width() && size[1] < other.Length() && size[2] < other.Height()) return true; else return false; } int Arrange(Box Box1, Box Box2) { /* Return 0 if neither box fits inside the other 1 if Box1 fits inside Box2 2 if Box2 fits inside Box1 3 if boxes are identical */ if (Box1 = Box2) return 3; if (Box1 < Box2) return 1; if (Box2 < Box1) return 2; return 0; } int main() { int n; cin >> n; int box1[24]; int box2[24]; for (int i = 1; i <= n; i++) { for (int j = 0; j < 24; j++) { cin >> box1[j]; } for (int j = 0; j < 24; j++) { cin >> box2[j]; } Box Box1(box1); Box Box2(box2); if (i != 1) { cout << endl; } switch (Arrange(Box1, Box2)) { case 0: cout << "Case " << i << ": neither box fits inside the other.\n"; break; case 1: cout << "Case " << i << ": box 1 fits inside box 2.\n"; break; case 2: cout << "Case " << i << ": box 2 fits inside box 1.\n"; break; case 3: cout << "Case " << i << ": boxes are identical.\n"; break; } } return 0; }