Prev: Como fazer um grafico de pareto utilizando o Excel 2007
Next: How can I determine and display my Time Zone?
From: Ali on 22 Nov 2008 03:31 1+3+5+7+9+11+13+15+17+19=100 Choose 5 numbers from these 10 figures so there sum is = 50
From: Mike Middleton on 22 Nov 2008 03:51 Ali - Tushar Mehta describes two methods with references to others: http://www.tushar-mehta.com/excel/templates/match_values/index.html - Mike Middleton http://www.DecisionToolworks.com Decision Analysis Add-ins for Excel "" <Ali(a)discussions.microsoft.com> wrote in message news:92D81C03-8E58-491E-9C75-6908E95264A1(a)microsoft.com... > 1+3+5+7+9+11+13+15+17+19=100 > Choose 5 numbers from these 10 figures so there sum is = 50
From: Dana DeLouis on 22 Nov 2008 07:24 Ali wrote: > 1+3+5+7+9+11+13+15+17+19=100 > Choose 5 numbers from these 10 figures so there sum is = 50 The sum of 5 Odd numbers is Odd also, so I don't believe there is a solution as stated that equals an even number (ie 50) - - - HTH Dana DeLouis
From: Gary''s Student on 22 Nov 2008 07:30 1+3+5+7+15+19 -- Gary''s Student - gsnu200815
From: joeu2004 on 22 Nov 2008 11:32 On Nov 22, 4:24 am, Dana DeLouis <delo...(a)bellsouth.net> wrote: > Ali wrote: > > 1+3+5+7+9+11+13+15+17+19=100 > > Choose 5 numbers from these 10 figures so there sum is = 50 > > The sum of 5 Odd numbers is Odd also, so I don't > believe there is a solution as stated that equals > an even number (ie 50) Why use well-founded reasoning when brute force will do the trick? Just kidding. But the following might be a useful paradigm for solving such problems when the answer is not so obvious. Sub doit() x = Array(1, 3, 5, 7, 9, 11, 13, 15, 17, 19) For i1 = 0 To UBound(x) - 4 For i2 = i1 + 1 To UBound(x) - 3 For i3 = i2 + 1 To UBound(x) - 2 For i4 = i3 + 1 To UBound(x) - 1 For i5 = i4 + 1 To UBound(x) Sum = x(i1) + x(i2) + x(i3) + x(i4) + x(i5) If Sum = 50 Then Debug.Print Sum; x(i1); x(i2); x(i3); x(i4); x(i5) Next i5: Next i4: Next i3: Next i2: Next i1 End Sub PS: Lots of solutions when choosing 6. I wonder if the OP simply mistyped.
|
Next
|
Last
Pages: 1 2 3 Prev: Como fazer um grafico de pareto utilizando o Excel 2007 Next: How can I determine and display my Time Zone? |