Предмет: Информатика, автор: Kabanos

9. Є дві коробки, перша розміром А1×В1×C1, друга
розміром A2×B2×C2. Визначте, чи можна розмістити
одну з цих коробок усередині іншої за умови, що
повертати коробки можна лише на 90 градусів навколо
ребер.

9. Есть две коробки, первая размером А1×В1×C1, вторая
размером A2×B2×C2. Определите, можно ли разместить
одну из этих коробок внутри другой при условии, что
поворачивать коробки можно только на 90 градусов вокруг
ребер.
Решите пж с помощью C++

Ответы

Автор ответа: asilvejstruk
2

Ответ:

#include <iostream>

using namespace std;

int main() {

   int A1, B1, C1, A2, B2, C2;

   cout << "Enter the dimensions of the first box: ";

   cin >> A1 >> B1 >> C1;

   cout << "Enter the dimensions of the second box: ";

   cin >> A2 >> B2 >> C2;

   if (A1 < A2 && B1 < B2 && C1 < C2) {

       cout << "The first box can be placed inside the second box." << endl;

   } else if (A1 < A2 && B1 < C2 && C1 < B2) {

       cout << "The first box can be placed inside the second box." << endl;

   } else if (A1 < B2 && B1 < A2 && C1 < C2) {

       cout << "The first box can be placed inside the second box." << endl;

   } else if (A1 < B2 && B1 < C2 && C1 < A2) {

       cout << "The first box can be placed inside the second box." << endl;

   } else if (A1 < C2 && B1 < A2 && C1 < B2) {

       cout << "The first box can be placed inside the second box." << endl;

   } else if (A1 < C2 && B1 < B2 && C1 < A2) {

       cout << "The first box can be placed inside the second box." << endl;

   } else {

       cout << "The first box cannot be placed inside the second box." << endl;

   }

   return 0;

}

Похожие вопросы