Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class _1_FitBoxInBox {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Scanner scan = new Scanner(System.in);
- int width1 = scan.nextInt();
- int height1 = scan.nextInt();
- int depth1 = scan.nextInt();
- int width2 = scan.nextInt();
- int height2 = scan.nextInt();
- int depth2 = scan.nextInt();
- int sumBox1 = width1 + height1 + depth1;
- int sumBox2 = width2 + height2 + depth2;
- if (sumBox2 > sumBox1) {
- checkToFitTheSmallerBoxInTheBiggerBoxInAllPossibleWaysAndPrintResult(
- width1, height1, depth1, width2, height2, depth2);
- } else if (sumBox1 > sumBox2) {
- checkToFitTheSmallerBoxInTheBiggerBoxInAllPossibleWaysAndPrintResult(
- width2, height2, depth2, width1, height1, depth1);
- }
- }
- private static void checkToFitTheSmallerBoxInTheBiggerBoxInAllPossibleWaysAndPrintResult(
- int w1, int h1, int d1, int w2, int h2, int d2) {
- // TODO Auto-generated method stub
- if (w1 < w2 && h1 < h2 && d1 < d2) {
- System.out.printf("(%d, %d, %d) < (%d, %d, %d)\n", w1, h1, d1, w2,
- h2, d2);
- }
- if (w1 < w2 && h1 < d2 && d1 < h2) {
- System.out.printf("(%d, %d, %d) < (%d, %d, %d)\n", w1, h1, d1, w2,
- d2, h2);
- }
- if (w1 < h2 && h1 < w2 && d1 < d2) {
- System.out.printf("(%d, %d, %d) < (%d, %d, %d)\n", w1, h1, d1, h2,
- w2, d2);
- }
- if (w1 < h2 && h1 < d2 && d1 < w2) {
- System.out.printf("(%d, %d, %d) < (%d, %d, %d)\n", w1, h1, d1, h2,
- d2, w2);
- }
- if (w1 < d2 && h1 < w2 && d1 < h2) {
- System.out.printf("(%d, %d, %d) < (%d, %d, %d)\n", w1, h1, d1, d2,
- w2, h2);
- }
- if (w1 < d2 && h1 < h2 && d1 < w2) {
- System.out.printf("(%d, %d, %d) < (%d, %d, %d)\n", w1, h1, d1, d2,
- h2, w2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement