El dilema del chocolate
Dos hermanas están comiendo chocolate. Cada trozo se representa mediante un arreglo de dos elementos que contiene su largo y su ancho.
Crea una función que devuelva true si el área total de chocolate es la misma para cada hermana.
En el primer ejemplo resuelto, se suma el área de cada trozo multiplicando su largo por su ancho. Ambas hermanas tienen 22 unidades cuadradas, por lo que el resultado es true.
Ejemplos
Program.testFairness(
new int[][] {{4, 3}, {2, 4}, {1, 2}},
new int[][] {{6, 2}, {4, 2}, {1, 1}, {1, 1}}
) ➞ true
// Agatha: 4×3 + 2×4 + 1×2 = 22
// Bertha: 6×2 + 4×2 + 1×1 + 1×1 = 22
Program.testFairness(new int[][] {{1, 2}, {2, 1}}, new int[][] {{2, 2}}) ➞ true
Program.testFairness(new int[][] {{1, 2}, {2, 1}}, new int[][] {{2, 2}, {4, 4}}) ➞ false
Program.testFairness(new int[][] {{2, 2}, {2, 2}, {2, 2}, {2, 2}}, new int[][] {{4, 4}}) ➞ true
Program.testFairness(new int[][] {{1, 5}, {6, 3}, {1, 1}}, new int[][] {{7, 1}, {2, 2}, {1, 1}}) ➞ falseNotas
N/A