两个整数数组之间的计算

时间:2015-10-04 08:13:31

标签: java arrays

我有一个随机生成的整数数组(A1),其中包含以下功能。

  1. 数组长度为4
  2. 元素填充了1到9
  3. 的整数值
  4. 没有重复值
  5. 以升序排序
  6. 现在有另一个数组(A2),它是A1的降序有序数组 我打算做的是,在这两个数组之间进行所有可能的线性和交叉计算(仅添加) 起始数组可以是A1或A2,但应始终以第0个元素开始 A1或A2中的值可以采用正或负两种形式进行计算 值应从数组/ s中以数组索引的递增顺序选择。

    示例:1 ex1

    示例:2 ex2

    示例:3
    ex3

    示例:4
    ex4

    起初,我一直试图通过仅使用for循环来实现这一点但后来我将递归应用于它。但是,它仅适用于计算一个或两个值。有没有有效的方法来做到这一点? 希望我的问题足够清楚!

    已编辑

    我们采取A1=[1,2,3,4]所以,A2=[4,3,2,1] 那么可能的计算结果应该如下

    1. 1 + nothing = 1
    2. -1 + nothing = -1
    3. 4 + nothing = 4
    4. -4 + nothing = -4
    5. 1 + 2 = 3
    6. 1 - 2 = -1
    7. 1 + 3 = 4
    8. 1 - 3 = -2
    9. -1 + 2 = 1
    10. -1 - 2 = -3
    11. -1 + 3 = 2
    12. -1 - 3 = -4
    13. 1 + 2 + 3 = 6
    14. ......
    15. ......
    16. 最后,对于4的数组长度,应该有340个可能的计算。

      1,-1,4,-4,3,-1,4,-2,1,-3,
      2,-4,6,2,7,1,-2,-6,-1,-7,
      6,0,5,1,2,-4,1,-3,7,1,
      6,2,1,5M,-4,4,-2,3,-1,
      0,-6,-1,-5,5,-1,4,0​​,-1,-7,
      -2,-6,9,3,8,4,5,-1,4,0​​,
      10,4,9,5,4,-2,3,-1,1,-5,
      0,-4,-3,-9,-4,-8,2,-4,1,-3,
      -4,-10,-5,-9,10,2,7,5,4,-4,
      1,-1,9,1,6,4,5,-3,2,0,
      6,-2,3,1,0,-8,-3,-5,5,-3,
      2,0,1,-7,-2,-4,11,3,8,6,
      5,-3,2,0,10,2,7,5,6,-2,
      3,1,5,3,-2,0,-1,-9,-4,-6,
      4,-4,1,-1,0,-8,-3,-5,8,0,
      5,3,2,-6,-1,-3,7,-1,4,2,
      3,-5,0,-2,4,-4,1,-1,-2,-10,
      -5,-7,3,-5,0,-2,-1,-9,-4,-6,
      9,1,6,4,3,5,-5,0,-2,8,0,
      5,3,4,-4,1,-1,3,-5,0,-2,
      -3,-11,-6,-8,2,-6,-1,-3,-2,-10,
      -5,-7,13,5,10,8,7,-1,4,2,
      12,4,9,7,8,0,5,3,9,1,
      6,4,3,-5,0,-2,8,0,5,3,
      4,-4,1,-1,14,6,11,9,8,0,
      5,3,13,5,10,8,9,1,6,4,
      8,0,5,3,2,-6,-1,-3,7,-1,
      4,2,3--5,0,-2,5,-3,2,0,
      -1,-9,-4,-6,4,-4,1,-1,0,-8,
      -3,-5,1,-7,-2,-4,-5,-13,-8,-10,
      0,-8,-3,-5,-4,-12,-7,-9,6,-2,
      3,1,0,-8,-3,-5,5,-3,2,0,
      1,-7,-2,-4,0,-8,-3,-5,-6,-14,
      -9,-11,-1,-9,-4,-6,-5,-13,-8,-10,

2 个答案:

答案 0 :(得分:2)

这样的东西?

public class Test {
    public static void main(String[] args) {
        Test test = new Test();
        System.out.println(Arrays.toString(test.A1));
        System.out.println(Arrays.toString(test.A2));
        System.out.println(test.result);
    }
    private int[] A1, A2;
    private List<Integer> result;
    private Test() {
        List<Integer> digits = new ArrayList<>(Arrays.asList(1,2,3,4,5,6,7,8,9));
        Random random = new Random();
        this.A1 = new int[4];
        for (int i = 0; i < this.A1.length; i++) {
            int idx = random.nextInt(digits.size());
            this.A1[i] = digits.remove(idx);
        }
        Arrays.sort(this.A1);

        this.A2 = new int[this.A1.length];
        for (int i = 0; i < this.A1.length; i++)
            this.A2[i] = this.A1[this.A1.length - i - 1];

        this.result = new ArrayList<>();
        for (int i = 0; i < this.A1.length; i++)
            calc(i, 0);
    }
    private void calc(int idx, int sum) {
        add(sum + this.A1[idx], idx + 1);
        add(sum - this.A1[idx], idx + 1);
        add(sum + this.A2[idx], idx + 1);
        add(sum - this.A2[idx], idx + 1);
    }
    private void add(int sum, int nextIdx) {
        this.result.add(sum);
        if (nextIdx < this.A1.length)
            calc(nextIdx, sum);
    }
}

输出

[1, 2, 4, 7]
[7, 4, 2, 1]
[1, 3, 7, 14, 0, 8, 6, -1, 6, -8, 0, -2, 5, 12, -2, 6, 4, 1, 8, -6, 2, 0, -1, 3, 10, -4, 4, 2, -5, 2, -12, -4, -6, 1, 8, -6, 2, 0, -3, 4, -10, -2, -4, 5, 9, 16, 2, 10, 8, 1, 8, -6, 2, 0, 7, 14, 0, 8, 6, 3, 10, -4, 4, 2, -3, 1, 8, -6, 2, 0, -7, 0, -14, -6, -8, -1, 6, -8, 0, -2, -5, 2, -12, -4, -6, -1, 1, 5, 12, -2, 6, 4, -3, 4, -10, -2, -4, 3, 10, -4, 4, 2, -1, 6, -8, 0, -2, -3, 1, 8, -6, 2, 0, -7, 0, -14, -6, -8, -1, 6, -8, 0, -2, -5, 2, -12, -4, -6, 3, 7, 14, 0, 8, 6, -1, 6, -8, 0, -2, 5, 12, -2, 6, 4, 1, 8, -6, 2, 0, -5, -1, 6, -8, 0, -2, -9, -2, -16, -8, -10, -3, 4, -10, -2, -4, -7, 0, -14, -6, -8, 7, 9, 13, 20, 6, 14, 12, 5, 12, -2, 6, 4, 11, 18, 4, 12, 10, 7, 14, 0, 8, 6, 5, 9, 16, 2, 10, 8, 1, 8, -6, 2, 0, 7, 14, 0, 8, 6, 3, 10, -4, 4, 2, 11, 15, 22, 8, 16, 14, 7, 14, 0, 8, 6, 13, 20, 6, 14, 12, 9, 16, 2, 10, 8, 3, 7, 14, 0, 8, 6, -1, 6, -8, 0, -2, 5, 12, -2, 6, 4, 1, 8, -6, 2, 0, -7, -5, -1, 6, -8, 0, -2, -9, -2, -16, -8, -10, -3, 4, -10, -2, -4, -7, 0, -14, -6, -8, -9, -5, 2, -12, -4, -6, -13, -6, -20, -12, -14, -7, 0, -14, -6, -8, -11, -4, -18, -10, -12, -3, 1, 8, -6, 2, 0, -7, 0, -14, -6, -8, -1, 6, -8, 0, -2, -5, 2, -12, -4, -6, -11, -7, 0, -14, -6, -8, -15, -8, -22, -14, -16, -9, -2, -16, -8, -10, -13, -6, -20, -12, -14, 2, 6, 13, -1, 7, 5, -2, 5, -9, -1, -3, 4, 11, -3, 5, 3, 0, 7, -7, 1, -1, -2, 2, 9, -5, 3, 1, -6, 1, -13, -5, -7, 0, 7, -7, 1, -1, -4, 3, -11, -3, -5, 4, 8, 15, 1, 9, 7, 0, 7, -7, 1, -1, 6, 13, -1, 7, 5, 2, 9, -5, 3, 1, -4, 0, 7, -7, 1, -1, -8, -1, -15, -7, -9, -2, 5, -9, -1, -3, -6, 1, -13, -5, -7, 4, 11, -3, 5, 3, -4, 3, -11, -3, -5, 2, 9, -5, 3, 1, -2, 5, -9, -1, -3, 7, -7, 1, -1]

<强>更新

由于您表示您希望编号和打印公式,因此这是一个非递归实现,它使用位模式选择每个1/4部分进行总结。

请注意,之前的实施和新的实施都会返回 448 组合,而不是您提到的340。

代码构建了所有组合的列表。然后,您可以选择对列表进行排序(如按组合长度排序),以及是否要收集总和,或者打印文本公式或数字公式。

public class Combo {
    public static void main(String[] args) {
        int[] A1 = { 1, 2, 3, 4 };
        int[] A2 = { 4, 3, 2, 1 };
        List<Combo> comboList = new ArrayList<>();
        for (int start = 0; start < A1.length; start++)
            for (int end = start; end < A1.length; end++) {
                final int combinations = 1 << ((end - start + 1) << 1); // 4 ^ (end - start + 1)
                for (int combo = 0; combo < combinations; combo++)
                    comboList.add(new Combo(start, end, combo));
            }
        Collections.sort(comboList, (c1, c2) -> Integer.compare(c1.end - c1.start, c2.end - c2.start));
        for (int i = 0; i < comboList.size(); i++) {
            Combo combo = comboList.get(i);
            System.out.printf("%3d: %-33s = %-17s = %d%n", i + 1, combo.getTextFormula(),
                              combo.getNumberFormula(A1, A2), combo.getSum(A1, A2));
        }
    }
    private final int start;
    private final int end;
    private final int combo;
    public Combo(int start, int end, int combo) {
        this.start = start;
        this.end = end;
        this.combo = combo;
    }
    private String getTextFormula() {
        StringBuilder buf = new StringBuilder();
        for (int i = this.start; i <= this.end; i++) {
            int c = this.combo >> ((this.end - i) << 1) & 3;
            if (i != this.start) buf.append(" + ");
            buf.append(c == 0 ? "A1" : c == 1 ? "-A1" : c == 2 ? "A2" : "-A2").append('[').append(i).append(']');
        }
        return buf.toString();
    }
    private String getNumberFormula(int[] A1, int[] A2) {
        StringBuilder buf = new StringBuilder();
        for (int i = this.start; i <= this.end; i++) {
            int c = this.combo >> ((this.end - i) << 1) & 3;
            if (i != this.start) buf.append(" + ");
            buf.append(c == 0 ? A1[i] : c == 1 ? -A1[i] : c == 2 ? A2[i] : -A2[i]);
        }
        return buf.toString();
    }
    private int getSum(int[] A1, int[] A2) {
        int sum = 0;
        for (int i = this.start; i <= this.end; i++) {
            int c = this.combo >> ((this.end - i) << 1) & 3;
            sum += (c == 0 ? A1[i] : c == 1 ? -A1[i] : c == 2 ? A2[i] : -A2[i]);
        }
        return sum;
    }
}

输出

  1: A1[0]                             = 1                 = 1
  2: -A1[0]                            = -1                = -1
  3: A2[0]                             = 4                 = 4
  4: -A2[0]                            = -4                = -4
  5: A1[1]                             = 2                 = 2
  6: -A1[1]                            = -2                = -2
  7: A2[1]                             = 3                 = 3
  8: -A2[1]                            = -3                = -3
  9: A1[2]                             = 3                 = 3
 10: -A1[2]                            = -3                = -3
 11: A2[2]                             = 2                 = 2
 12: -A2[2]                            = -2                = -2
 13: A1[3]                             = 4                 = 4
 14: -A1[3]                            = -4                = -4
 15: A2[3]                             = 1                 = 1
 16: -A2[3]                            = -1                = -1
 17: A1[0] + A1[1]                     = 1 + 2             = 3
 18: A1[0] + -A1[1]                    = 1 + -2            = -1
 . . .
 63: -A2[2] + A2[3]                    = -2 + 1            = -1
 64: -A2[2] + -A2[3]                   = -2 + -1           = -3
 65: A1[0] + A1[1] + A1[2]             = 1 + 2 + 3         = 6
 66: A1[0] + A1[1] + -A1[2]            = 1 + 2 + -3        = 0
 . . .
127: -A2[0] + -A2[1] + A2[2]           = -4 + -3 + 2       = -5
128: -A2[0] + -A2[1] + -A2[2]          = -4 + -3 + -2      = -9
129: A1[1] + A1[2] + A1[3]             = 2 + 3 + 4         = 9
130: A1[1] + A1[2] + -A1[3]            = 2 + 3 + -4        = 1
 . . .
191: -A2[1] + -A2[2] + A2[3]           = -3 + -2 + 1       = -4
192: -A2[1] + -A2[2] + -A2[3]          = -3 + -2 + -1      = -6
193: A1[0] + A1[1] + A1[2] + A1[3]     = 1 + 2 + 3 + 4     = 10
194: A1[0] + A1[1] + A1[2] + -A1[3]    = 1 + 2 + 3 + -4    = 2
 . . .
255: A1[0] + -A2[1] + -A2[2] + A2[3]   = 1 + -3 + -2 + 1   = -3
256: A1[0] + -A2[1] + -A2[2] + -A2[3]  = 1 + -3 + -2 + -1  = -5
257: -A1[0] + A1[1] + A1[2] + A1[3]    = -1 + 2 + 3 + 4    = 8
258: -A1[0] + A1[1] + A1[2] + -A1[3]   = -1 + 2 + 3 + -4   = 0
 . . .
319: -A1[0] + -A2[1] + -A2[2] + A2[3]  = -1 + -3 + -2 + 1  = -5
320: -A1[0] + -A2[1] + -A2[2] + -A2[3] = -1 + -3 + -2 + -1 = -7
321: A2[0] + A1[1] + A1[2] + A1[3]     = 4 + 2 + 3 + 4     = 13
322: A2[0] + A1[1] + A1[2] + -A1[3]    = 4 + 2 + 3 + -4    = 5
 . . .
383: A2[0] + -A2[1] + -A2[2] + A2[3]   = 4 + -3 + -2 + 1   = 0
384: A2[0] + -A2[1] + -A2[2] + -A2[3]  = 4 + -3 + -2 + -1  = -2
385: -A2[0] + A1[1] + A1[2] + A1[3]    = -4 + 2 + 3 + 4    = 5
386: -A2[0] + A1[1] + A1[2] + -A1[3]   = -4 + 2 + 3 + -4   = -3
 . . .
440: -A2[0] + -A2[1] + -A1[2] + -A2[3] = -4 + -3 + -3 + -1 = -11
441: -A2[0] + -A2[1] + A2[2] + A1[3]   = -4 + -3 + 2 + 4   = -1
442: -A2[0] + -A2[1] + A2[2] + -A1[3]  = -4 + -3 + 2 + -4  = -9
443: -A2[0] + -A2[1] + A2[2] + A2[3]   = -4 + -3 + 2 + 1   = -4
444: -A2[0] + -A2[1] + A2[2] + -A2[3]  = -4 + -3 + 2 + -1  = -6
445: -A2[0] + -A2[1] + -A2[2] + A1[3]  = -4 + -3 + -2 + 4  = -5
446: -A2[0] + -A2[1] + -A2[2] + -A1[3] = -4 + -3 + -2 + -4 = -13
447: -A2[0] + -A2[1] + -A2[2] + A2[3]  = -4 + -3 + -2 + 1  = -8
448: -A2[0] + -A2[1] + -A2[2] + -A2[3] = -4 + -3 + -2 + -1 = -10

答案 1 :(得分:1)

以下是我能为您写的内容:

来源:

public static void main(String[] args) {
    Holder[] A1 = { new Holder("A1.1", 4), new Holder("A1.2", 2),
            new Holder("A1.3", 5), new Holder("A1.4", 6) };
    Holder[] A2 = new Holder[A1.length];
    for (int i = A1.length - 1; i > -1; i--) {
        A2[A2.length - i - 1] = new Holder(("A2." + (A2.length - i)),
                A1[i].value);
    }

    processArrays(A1, A2);
    processArrays(A2, A1);
}

static class Holder {
    private Holder(String location, int value) {
        this.value = value;
        this.location = location;
    }

    private int value;
    private String location;

    @Override
    public String toString() {
        return "[" + location + "," + value + "]";
    }
}

private static void processArrays(Holder[] a1, Holder[] a2) {
    for (int l = a1.length; l > -1; l--) {
        List<Holder> holderList = new ArrayList<>();
        for (int i = 0; i < l; i++) {
            holderList.add(a1[i]);
        }
        if (l > 0 && l < a2.length) {
            List<Holder> a1HolderList = new ArrayList<>();
            for (int i = 0; i < l; i++) {
                a1HolderList.add(a1[i]);
            }
            calculateCombinations(a1HolderList);
            for (int il = a2.length - l; il > 0; il--) {
                List<Holder> totalHolderList = new ArrayList<>(a1HolderList);
                for (int ii = l + il - 1; ii >= l; ii--) {
                    totalHolderList.add(a2[ii]);
                }
                calculateCombinations(totalHolderList);
            }
        }
    }
}

private static void calculateCombinations(List<Holder> holderList) {
    System.out.println();
    BitSet bitSet = BitSet.valueOf(new long[] { 0 });

    do {
        StringBuilder expressionBuilder = new StringBuilder();
        StringBuilder valueBuilder = new StringBuilder();
        boolean valueAdded = false;
        int expressionValue = 0;
        for (int i = 0; i < holderList.size(); i++) {
            Holder holder = holderList.get(i);
            if (valueAdded) {
                expressionBuilder.append(" + ");
                valueBuilder.append(" + ");
            }
            expressionBuilder.append("(");
            expressionBuilder.append(bitSet.get(i) ? '-' : "");
            expressionValue += (bitSet.get(i) ? 0 - holder.value
                    : holder.value);
            expressionBuilder.append(holder.location);
            expressionBuilder.append(")");

            valueBuilder.append("(");
            if (bitSet.get(i)) {
                valueBuilder.append("-(");
                valueBuilder.append(holder.value);
                valueBuilder.append(")");
            } else {
                valueBuilder.append(holder.value);
            }
            valueBuilder.append(")");

            valueAdded = true;
        }
        System.out.print(expressionBuilder);
        System.out.print("\t=\t");
        System.out.print(valueBuilder);
        System.out.print("\t=\t");
        System.out.println(expressionValue);
        bitSet = incrementBitset(bitSet);
    } while (bitSet.length() <= holderList.size());
    System.out.println();
}

private static BitSet incrementBitset(BitSet bitSet) {

    BitSet returnSet = null;
    if (bitSet.toLongArray().length == 0) {
        returnSet = BitSet.valueOf(new long[] { 1 });
    } else {
        int integerValue = (int) bitSet.toLongArray()[0];
        returnSet = BitSet.valueOf(new long[] { integerValue + 1 });
    }
    return returnSet;
}

输出:

(A1.1) + (A1.2) + (A1.3)    =   (4) + (2) + (5) =   11
(-A1.1) + (A1.2) + (A1.3)   =   (-(4)) + (2) + (5)  =   3
(A1.1) + (-A1.2) + (A1.3)   =   (4) + (-(2)) + (5)  =   7
(-A1.1) + (-A1.2) + (A1.3)  =   (-(4)) + (-(2)) + (5)   =   -1
(A1.1) + (A1.2) + (-A1.3)   =   (4) + (2) + (-(5))  =   1
(-A1.1) + (A1.2) + (-A1.3)  =   (-(4)) + (2) + (-(5))   =   -7
(A1.1) + (-A1.2) + (-A1.3)  =   (4) + (-(2)) + (-(5))   =   -3
(-A1.1) + (-A1.2) + (-A1.3) =   (-(4)) + (-(2)) + (-(5))    =   -11


(A1.1) + (A1.2) + (A1.3) + (A2.4)   =   (4) + (2) + (5) + (4)   =   15
(-A1.1) + (A1.2) + (A1.3) + (A2.4)  =   (-(4)) + (2) + (5) + (4)    =   7
(A1.1) + (-A1.2) + (A1.3) + (A2.4)  =   (4) + (-(2)) + (5) + (4)    =   11
(-A1.1) + (-A1.2) + (A1.3) + (A2.4) =   (-(4)) + (-(2)) + (5) + (4) =   3
(A1.1) + (A1.2) + (-A1.3) + (A2.4)  =   (4) + (2) + (-(5)) + (4)    =   5
(-A1.1) + (A1.2) + (-A1.3) + (A2.4) =   (-(4)) + (2) + (-(5)) + (4) =   -3
(A1.1) + (-A1.2) + (-A1.3) + (A2.4) =   (4) + (-(2)) + (-(5)) + (4) =   1
(-A1.1) + (-A1.2) + (-A1.3) + (A2.4)    =   (-(4)) + (-(2)) + (-(5)) + (4)  =   -7
(A1.1) + (A1.2) + (A1.3) + (-A2.4)  =   (4) + (2) + (5) + (-(4))    =   7
(-A1.1) + (A1.2) + (A1.3) + (-A2.4) =   (-(4)) + (2) + (5) + (-(4)) =   -1
(A1.1) + (-A1.2) + (A1.3) + (-A2.4) =   (4) + (-(2)) + (5) + (-(4)) =   3
(-A1.1) + (-A1.2) + (A1.3) + (-A2.4)    =   (-(4)) + (-(2)) + (5) + (-(4))  =   -5
(A1.1) + (A1.2) + (-A1.3) + (-A2.4) =   (4) + (2) + (-(5)) + (-(4)) =   -3
(-A1.1) + (A1.2) + (-A1.3) + (-A2.4)    =   (-(4)) + (2) + (-(5)) + (-(4))  =   -11
(A1.1) + (-A1.2) + (-A1.3) + (-A2.4)    =   (4) + (-(2)) + (-(5)) + (-(4))  =   -7
(-A1.1) + (-A1.2) + (-A1.3) + (-A2.4)   =   (-(4)) + (-(2)) + (-(5)) + (-(4))   =   -15


(A1.1) + (A1.2) =   (4) + (2)   =   6
(-A1.1) + (A1.2)    =   (-(4)) + (2)    =   -2
(A1.1) + (-A1.2)    =   (4) + (-(2))    =   2
(-A1.1) + (-A1.2)   =   (-(4)) + (-(2)) =   -6


(A1.1) + (A1.2) + (A2.4) + (A2.3)   =   (4) + (2) + (4) + (2)   =   12
(-A1.1) + (A1.2) + (A2.4) + (A2.3)  =   (-(4)) + (2) + (4) + (2)    =   4
(A1.1) + (-A1.2) + (A2.4) + (A2.3)  =   (4) + (-(2)) + (4) + (2)    =   8
(-A1.1) + (-A1.2) + (A2.4) + (A2.3) =   (-(4)) + (-(2)) + (4) + (2) =   0
(A1.1) + (A1.2) + (-A2.4) + (A2.3)  =   (4) + (2) + (-(4)) + (2)    =   4
(-A1.1) + (A1.2) + (-A2.4) + (A2.3) =   (-(4)) + (2) + (-(4)) + (2) =   -4
(A1.1) + (-A1.2) + (-A2.4) + (A2.3) =   (4) + (-(2)) + (-(4)) + (2) =   0
(-A1.1) + (-A1.2) + (-A2.4) + (A2.3)    =   (-(4)) + (-(2)) + (-(4)) + (2)  =   -8
(A1.1) + (A1.2) + (A2.4) + (-A2.3)  =   (4) + (2) + (4) + (-(2))    =   8
(-A1.1) + (A1.2) + (A2.4) + (-A2.3) =   (-(4)) + (2) + (4) + (-(2)) =   0
(A1.1) + (-A1.2) + (A2.4) + (-A2.3) =   (4) + (-(2)) + (4) + (-(2)) =   4
(-A1.1) + (-A1.2) + (A2.4) + (-A2.3)    =   (-(4)) + (-(2)) + (4) + (-(2))  =   -4
(A1.1) + (A1.2) + (-A2.4) + (-A2.3) =   (4) + (2) + (-(4)) + (-(2)) =   0
(-A1.1) + (A1.2) + (-A2.4) + (-A2.3)    =   (-(4)) + (2) + (-(4)) + (-(2))  =   -8
(A1.1) + (-A1.2) + (-A2.4) + (-A2.3)    =   (4) + (-(2)) + (-(4)) + (-(2))  =   -4
(-A1.1) + (-A1.2) + (-A2.4) + (-A2.3)   =   (-(4)) + (-(2)) + (-(4)) + (-(2))   =   -12


(A1.1) + (A1.2) + (A2.3)    =   (4) + (2) + (2) =   8
(-A1.1) + (A1.2) + (A2.3)   =   (-(4)) + (2) + (2)  =   0
(A1.1) + (-A1.2) + (A2.3)   =   (4) + (-(2)) + (2)  =   4
(-A1.1) + (-A1.2) + (A2.3)  =   (-(4)) + (-(2)) + (2)   =   -4
(A1.1) + (A1.2) + (-A2.3)   =   (4) + (2) + (-(2))  =   4
(-A1.1) + (A1.2) + (-A2.3)  =   (-(4)) + (2) + (-(2))   =   -4
(A1.1) + (-A1.2) + (-A2.3)  =   (4) + (-(2)) + (-(2))   =   0
(-A1.1) + (-A1.2) + (-A2.3) =   (-(4)) + (-(2)) + (-(2))    =   -8


(A1.1)  =   (4) =   4
(-A1.1) =   (-(4))  =   -4


(A1.1) + (A2.4) + (A2.3) + (A2.2)   =   (4) + (4) + (2) + (5)   =   15
(-A1.1) + (A2.4) + (A2.3) + (A2.2)  =   (-(4)) + (4) + (2) + (5)    =   7
(A1.1) + (-A2.4) + (A2.3) + (A2.2)  =   (4) + (-(4)) + (2) + (5)    =   7
(-A1.1) + (-A2.4) + (A2.3) + (A2.2) =   (-(4)) + (-(4)) + (2) + (5) =   -1
(A1.1) + (A2.4) + (-A2.3) + (A2.2)  =   (4) + (4) + (-(2)) + (5)    =   11
(-A1.1) + (A2.4) + (-A2.3) + (A2.2) =   (-(4)) + (4) + (-(2)) + (5) =   3
(A1.1) + (-A2.4) + (-A2.3) + (A2.2) =   (4) + (-(4)) + (-(2)) + (5) =   3
(-A1.1) + (-A2.4) + (-A2.3) + (A2.2)    =   (-(4)) + (-(4)) + (-(2)) + (5)  =   -5
(A1.1) + (A2.4) + (A2.3) + (-A2.2)  =   (4) + (4) + (2) + (-(5))    =   5
(-A1.1) + (A2.4) + (A2.3) + (-A2.2) =   (-(4)) + (4) + (2) + (-(5)) =   -3
(A1.1) + (-A2.4) + (A2.3) + (-A2.2) =   (4) + (-(4)) + (2) + (-(5)) =   -3
(-A1.1) + (-A2.4) + (A2.3) + (-A2.2)    =   (-(4)) + (-(4)) + (2) + (-(5))  =   -11
(A1.1) + (A2.4) + (-A2.3) + (-A2.2) =   (4) + (4) + (-(2)) + (-(5)) =   1
(-A1.1) + (A2.4) + (-A2.3) + (-A2.2)    =   (-(4)) + (4) + (-(2)) + (-(5))  =   -7
(A1.1) + (-A2.4) + (-A2.3) + (-A2.2)    =   (4) + (-(4)) + (-(2)) + (-(5))  =   -7
(-A1.1) + (-A2.4) + (-A2.3) + (-A2.2)   =   (-(4)) + (-(4)) + (-(2)) + (-(5))   =   -15


(A1.1) + (A2.3) + (A2.2)    =   (4) + (2) + (5) =   11
(-A1.1) + (A2.3) + (A2.2)   =   (-(4)) + (2) + (5)  =   3
(A1.1) + (-A2.3) + (A2.2)   =   (4) + (-(2)) + (5)  =   7
(-A1.1) + (-A2.3) + (A2.2)  =   (-(4)) + (-(2)) + (5)   =   -1
(A1.1) + (A2.3) + (-A2.2)   =   (4) + (2) + (-(5))  =   1
(-A1.1) + (A2.3) + (-A2.2)  =   (-(4)) + (2) + (-(5))   =   -7
(A1.1) + (-A2.3) + (-A2.2)  =   (4) + (-(2)) + (-(5))   =   -3
(-A1.1) + (-A2.3) + (-A2.2) =   (-(4)) + (-(2)) + (-(5))    =   -11


(A1.1) + (A2.2) =   (4) + (5)   =   9
(-A1.1) + (A2.2)    =   (-(4)) + (5)    =   1
(A1.1) + (-A2.2)    =   (4) + (-(5))    =   -1
(-A1.1) + (-A2.2)   =   (-(4)) + (-(5)) =   -9


(A2.1) + (A2.2) + (A2.3)    =   (6) + (5) + (2) =   13
(-A2.1) + (A2.2) + (A2.3)   =   (-(6)) + (5) + (2)  =   1
(A2.1) + (-A2.2) + (A2.3)   =   (6) + (-(5)) + (2)  =   3
(-A2.1) + (-A2.2) + (A2.3)  =   (-(6)) + (-(5)) + (2)   =   -9
(A2.1) + (A2.2) + (-A2.3)   =   (6) + (5) + (-(2))  =   9
(-A2.1) + (A2.2) + (-A2.3)  =   (-(6)) + (5) + (-(2))   =   -3
(A2.1) + (-A2.2) + (-A2.3)  =   (6) + (-(5)) + (-(2))   =   -1
(-A2.1) + (-A2.2) + (-A2.3) =   (-(6)) + (-(5)) + (-(2))    =   -13


(A2.1) + (A2.2) + (A2.3) + (A1.4)   =   (6) + (5) + (2) + (6)   =   19
(-A2.1) + (A2.2) + (A2.3) + (A1.4)  =   (-(6)) + (5) + (2) + (6)    =   7
(A2.1) + (-A2.2) + (A2.3) + (A1.4)  =   (6) + (-(5)) + (2) + (6)    =   9
(-A2.1) + (-A2.2) + (A2.3) + (A1.4) =   (-(6)) + (-(5)) + (2) + (6) =   -3
(A2.1) + (A2.2) + (-A2.3) + (A1.4)  =   (6) + (5) + (-(2)) + (6)    =   15
(-A2.1) + (A2.2) + (-A2.3) + (A1.4) =   (-(6)) + (5) + (-(2)) + (6) =   3
(A2.1) + (-A2.2) + (-A2.3) + (A1.4) =   (6) + (-(5)) + (-(2)) + (6) =   5
(-A2.1) + (-A2.2) + (-A2.3) + (A1.4)    =   (-(6)) + (-(5)) + (-(2)) + (6)  =   -7
(A2.1) + (A2.2) + (A2.3) + (-A1.4)  =   (6) + (5) + (2) + (-(6))    =   7
(-A2.1) + (A2.2) + (A2.3) + (-A1.4) =   (-(6)) + (5) + (2) + (-(6)) =   -5
(A2.1) + (-A2.2) + (A2.3) + (-A1.4) =   (6) + (-(5)) + (2) + (-(6)) =   -3
(-A2.1) + (-A2.2) + (A2.3) + (-A1.4)    =   (-(6)) + (-(5)) + (2) + (-(6))  =   -15
(A2.1) + (A2.2) + (-A2.3) + (-A1.4) =   (6) + (5) + (-(2)) + (-(6)) =   3
(-A2.1) + (A2.2) + (-A2.3) + (-A1.4)    =   (-(6)) + (5) + (-(2)) + (-(6))  =   -9
(A2.1) + (-A2.2) + (-A2.3) + (-A1.4)    =   (6) + (-(5)) + (-(2)) + (-(6))  =   -7
(-A2.1) + (-A2.2) + (-A2.3) + (-A1.4)   =   (-(6)) + (-(5)) + (-(2)) + (-(6))   =   -19


(A2.1) + (A2.2) =   (6) + (5)   =   11
(-A2.1) + (A2.2)    =   (-(6)) + (5)    =   -1
(A2.1) + (-A2.2)    =   (6) + (-(5))    =   1
(-A2.1) + (-A2.2)   =   (-(6)) + (-(5)) =   -11


(A2.1) + (A2.2) + (A1.4) + (A1.3)   =   (6) + (5) + (6) + (5)   =   22
(-A2.1) + (A2.2) + (A1.4) + (A1.3)  =   (-(6)) + (5) + (6) + (5)    =   10
(A2.1) + (-A2.2) + (A1.4) + (A1.3)  =   (6) + (-(5)) + (6) + (5)    =   12
(-A2.1) + (-A2.2) + (A1.4) + (A1.3) =   (-(6)) + (-(5)) + (6) + (5) =   0
(A2.1) + (A2.2) + (-A1.4) + (A1.3)  =   (6) + (5) + (-(6)) + (5)    =   10
(-A2.1) + (A2.2) + (-A1.4) + (A1.3) =   (-(6)) + (5) + (-(6)) + (5) =   -2
(A2.1) + (-A2.2) + (-A1.4) + (A1.3) =   (6) + (-(5)) + (-(6)) + (5) =   0
(-A2.1) + (-A2.2) + (-A1.4) + (A1.3)    =   (-(6)) + (-(5)) + (-(6)) + (5)  =   -12
(A2.1) + (A2.2) + (A1.4) + (-A1.3)  =   (6) + (5) + (6) + (-(5))    =   12
(-A2.1) + (A2.2) + (A1.4) + (-A1.3) =   (-(6)) + (5) + (6) + (-(5)) =   0
(A2.1) + (-A2.2) + (A1.4) + (-A1.3) =   (6) + (-(5)) + (6) + (-(5)) =   2
(-A2.1) + (-A2.2) + (A1.4) + (-A1.3)    =   (-(6)) + (-(5)) + (6) + (-(5))  =   -10
(A2.1) + (A2.2) + (-A1.4) + (-A1.3) =   (6) + (5) + (-(6)) + (-(5)) =   0
(-A2.1) + (A2.2) + (-A1.4) + (-A1.3)    =   (-(6)) + (5) + (-(6)) + (-(5))  =   -12
(A2.1) + (-A2.2) + (-A1.4) + (-A1.3)    =   (6) + (-(5)) + (-(6)) + (-(5))  =   -10
(-A2.1) + (-A2.2) + (-A1.4) + (-A1.3)   =   (-(6)) + (-(5)) + (-(6)) + (-(5))   =   -22


(A2.1) + (A2.2) + (A1.3)    =   (6) + (5) + (5) =   16
(-A2.1) + (A2.2) + (A1.3)   =   (-(6)) + (5) + (5)  =   4
(A2.1) + (-A2.2) + (A1.3)   =   (6) + (-(5)) + (5)  =   6
(-A2.1) + (-A2.2) + (A1.3)  =   (-(6)) + (-(5)) + (5)   =   -6
(A2.1) + (A2.2) + (-A1.3)   =   (6) + (5) + (-(5))  =   6
(-A2.1) + (A2.2) + (-A1.3)  =   (-(6)) + (5) + (-(5))   =   -6
(A2.1) + (-A2.2) + (-A1.3)  =   (6) + (-(5)) + (-(5))   =   -4
(-A2.1) + (-A2.2) + (-A1.3) =   (-(6)) + (-(5)) + (-(5))    =   -16


(A2.1)  =   (6) =   6
(-A2.1) =   (-(6))  =   -6


(A2.1) + (A1.4) + (A1.3) + (A1.2)   =   (6) + (6) + (5) + (2)   =   19
(-A2.1) + (A1.4) + (A1.3) + (A1.2)  =   (-(6)) + (6) + (5) + (2)    =   7
(A2.1) + (-A1.4) + (A1.3) + (A1.2)  =   (6) + (-(6)) + (5) + (2)    =   7
(-A2.1) + (-A1.4) + (A1.3) + (A1.2) =   (-(6)) + (-(6)) + (5) + (2) =   -5
(A2.1) + (A1.4) + (-A1.3) + (A1.2)  =   (6) + (6) + (-(5)) + (2)    =   9
(-A2.1) + (A1.4) + (-A1.3) + (A1.2) =   (-(6)) + (6) + (-(5)) + (2) =   -3
(A2.1) + (-A1.4) + (-A1.3) + (A1.2) =   (6) + (-(6)) + (-(5)) + (2) =   -3
(-A2.1) + (-A1.4) + (-A1.3) + (A1.2)    =   (-(6)) + (-(6)) + (-(5)) + (2)  =   -15
(A2.1) + (A1.4) + (A1.3) + (-A1.2)  =   (6) + (6) + (5) + (-(2))    =   15
(-A2.1) + (A1.4) + (A1.3) + (-A1.2) =   (-(6)) + (6) + (5) + (-(2)) =   3
(A2.1) + (-A1.4) + (A1.3) + (-A1.2) =   (6) + (-(6)) + (5) + (-(2)) =   3
(-A2.1) + (-A1.4) + (A1.3) + (-A1.2)    =   (-(6)) + (-(6)) + (5) + (-(2))  =   -9
(A2.1) + (A1.4) + (-A1.3) + (-A1.2) =   (6) + (6) + (-(5)) + (-(2)) =   5
(-A2.1) + (A1.4) + (-A1.3) + (-A1.2)    =   (-(6)) + (6) + (-(5)) + (-(2))  =   -7
(A2.1) + (-A1.4) + (-A1.3) + (-A1.2)    =   (6) + (-(6)) + (-(5)) + (-(2))  =   -7
(-A2.1) + (-A1.4) + (-A1.3) + (-A1.2)   =   (-(6)) + (-(6)) + (-(5)) + (-(2))   =   -19


(A2.1) + (A1.3) + (A1.2)    =   (6) + (5) + (2) =   13
(-A2.1) + (A1.3) + (A1.2)   =   (-(6)) + (5) + (2)  =   1
(A2.1) + (-A1.3) + (A1.2)   =   (6) + (-(5)) + (2)  =   3
(-A2.1) + (-A1.3) + (A1.2)  =   (-(6)) + (-(5)) + (2)   =   -9
(A2.1) + (A1.3) + (-A1.2)   =   (6) + (5) + (-(2))  =   9
(-A2.1) + (A1.3) + (-A1.2)  =   (-(6)) + (5) + (-(2))   =   -3
(A2.1) + (-A1.3) + (-A1.2)  =   (6) + (-(5)) + (-(2))   =   -1
(-A2.1) + (-A1.3) + (-A1.2) =   (-(6)) + (-(5)) + (-(2))    =   -13


(A2.1) + (A1.2) =   (6) + (2)   =   8
(-A2.1) + (A1.2)    =   (-(6)) + (2)    =   -4
(A2.1) + (-A1.2)    =   (6) + (-(2))    =   4
(-A2.1) + (-A1.2)   =   (-(6)) + (-(2)) =   -8