Kevin will start with the integers 1, 2, 3 and 4 each used exactly once and written in a row in any order. Then he will find the sum of the

Question

Kevin will start with the integers 1, 2, 3 and 4 each used exactly once and written in a row in any order. Then he will find the sum of the adjacent pairs of integers in each row to make a new row, until one integer is left. For example, if he starts with 3, 2, 1, 4, then he takes sums to get 5, 3, 5, followed by 8, 8, and he ends with the final sum 16. Including all of Kevin’s possible starting arrangements of the integers 1, 2, 3 and 4, how many possible final sums are there?

in progress 0
niczorrrr 5 years 2021-08-03T17:36:21+00:00 1 Answers 86 views 1

Answers ( )

    0
    2021-08-03T17:38:07+00:00

    Hello,

    there are 5 differents sums:

    16,18,20,22,24.

    ——————————————————-

    Dim i As Integer, j As Integer, k As Integer, l As Integer, u As Integer, v As Integer, nb As Integer

    Dim mat(4, 4) As Integer

    nb = 0

    For i = 1 To 4

       For j = 1 To 4

           If j <> i Then

               For k = 1 To 4

                   If k <> j And k <> i Then

                       l = 10 – k – j – i

                       If l > 0 And l < 5 And l <> i And l <> j And l <> k Then

                           mat(1, 1) = i

                           mat(1, 2) = j

                           mat(1, 3) = k

                           mat(1, 4) = l

                           For u = 2 To 4

                               For v = 1 To 4 – u + 1

                                   mat(u, v) = mat(u – 1, v) + mat(u – 1, v + 1)

                               Next v

                           Next u

                           ‘Call visu(mat())

                           nb = nb + 1

                           Print nb,

                           mat(4, 1)

                       End If

                   End If

               Next k

           End If

       Next j

    Next i

    End

    Sub visu (m() As Integer)

       Dim i As Integer, j As Integer

       For i = 1 To 4

           For j = 1 To 4 – i + 1

               Print m(i, j);

           Next j

           Print

       Next i

    End Sub

Leave an answer

Browse

Giải phương trình 1 ẩn: x + 2 - 2(x + 1) = -x . Hỏi x = ? ( )