|
||
Title: Adding signs to make 100 Post by elway on Nov 30th, 2004, 1:21pm Ok, Here is a set of numbers: 1 2 3 4 5 6 7 8 9 You need to add plus and minus signs so that it equals 100. Here is one way to do it: 1+2+3-4+5+6+78+9=100 Can you help me find other ways? |
||
Title: Re: This is driving me nuts! Post by towr on Nov 30th, 2004, 2:55pm here's two 12+3+4+5-6-7+89 = 100 1+23-4+56+7+8+9 = 100 |
||
Title: Re: This is driving me nuts! Post by elway on Nov 30th, 2004, 3:00pm thnx, is there any more? |
||
Title: Re: This is driving me nuts! Post by Grimbal on Nov 30th, 2004, 3:03pm Here are some: 1+2+3-4+5+6+78+9 1+2+34-5+67-8+9 1+23-4+5+6+78-9 1+23-4+56+7+8+9 -1+2-3+4+5+6+78+9 12+3+4+5-6-7+89 12+3-4+5+67+8+9 12-3-4+5-6+7+89 123-4-5-6-7+8-9 123+45-67+8-9 123-45-67+89 |
||
Title: Re: This is driving me nuts! Post by Barukh on Dec 1st, 2004, 1:07am Although there are many, many more solutions, there are only 10 different types of solutions – w.r.t. how digits are partitioned into numbers: 1. 123, 45, 67, 89 2. 123, 4, 5, 67, 89 3. 123, 45, 67, 8, 9 4. 1, 2, 34, 5, 67, 8, 9 5. 1, 23, 4, 5, 6, 78, 9 6. 1, 23, 4, 56, 7, 8, 9 7. 12, 3, 4, 5, 6, 7, 89 8. 12, 3, 4, 5, 67, 8, 9 9. 123, 4, 5, 6, 7, 8, 9 10. 1, 2, 3, 4, 5, 6, 78, 9 All types but one (#2) were exemplified in previous posts. The remaining type has the following solution: 123 + 4 - 5 - 67 + 89 = 100 Another question: How many different types there exist if we reverse the order of digits? |
||
Title: Re: This is driving me nuts! Post by Grimbal on Dec 1st, 2004, 12:22pm 1. 9 8 7 65 4 32 1 2. 9 8 76 5 4 3 2 1 3. 9 8 76 5 4 3 21 4. 9 8 76 5 43 2 1 5. 9 8 76 54 32 1 6. 98 7 6 5 4 3 2 1 7. 98 7 6 5 4 3 21 8. 98 76 54 3 21 |
||
Title: Re: Adding signs to make 100 Post by elway on Dec 3rd, 2004, 1:16pm can someone tell me how u get those so quickly, and like show work or something. |
||
Title: Re: Adding signs to make 100 Post by Barukh on Dec 5th, 2004, 11:41pm on 12/03/04 at 13:16:35, elway wrote:
In my case, there wasn’t too much cleverness: I once wrote a program for another thread (much more difficult problem), and now I am using it from time to time to solve this kind of questions. So, if you wish, it was one-time cleverness. ;D To demonstrate, here’s a much tougher question: |
||
Title: Re: Adding signs to make 100 Post by Grimbal on Dec 6th, 2004, 8:01am In my case it was a small program I wrote from scratch. I can post it if you are interested. |
||
Title: Re: Adding signs to make 100 Post by krishna366 on May 14th, 2005, 5:19am This question was asked to me in ORACLE interview. My answer 1+2+3+4+5+6+7+(8*9) i started from back.... 8*9=72. so i still require 28. then suddenly i got a thought that for every odd number u will have (n - 1)/2 combinations in [ 1, n-1] which sum up to n. SO i wrote sigma(1 to 7)+pi(8 * 9) [Ya u have to write all these to impress ur interviewer......... |
||
Powered by YaBB 1 Gold - SP 1.4! Forum software copyright © 2000-2004 Yet another Bulletin Board |