Hello, I will need to find all of the distinct results.But first I should represent them. Also, operatoions always performed based on priority but not left to right.
I could not implement to code. Therefore, I divide the problem in two sections: 1. Representing distinct sequences 2. Computing sequences with operators Thanks a lot for if you could help me. On Thu, Nov 15, 2012 at 10:47 AM, Joseph DeVincentis <[email protected]>wrote: > What's the goal? Do you want the number of distinct operation sequences > that are valid, or do you want to find all the distinct results? Are the > operations always performed left to right, or using order of operations > with multiplication and division first? > > You also need to avoid dividing by zero. (2 / 0 + 1 = wrong) > > You can model the concatenation of two or more digits into a multi-digit > number as a fifth operator. > > > On Thu, Nov 15, 2012 at 10:36 AM, Amir Hossein Sharifzadeh < > [email protected]> wrote: > >> Hi, >> >> Suppose we have a number and some operators(*,-,+,/). We would like to >> represent and compute operators along operands during a number. >> For example: >> >> N = 201 >> Operators: +,-,* and / >> >> Results should be represented as following down: (I represented just + >> and - operators) >> 2 + 0 + 1 >> 2 + 01 (wrong) >> 20 + 1 >> >> 2 + 0 - 1 >> 2 - 01 (wrong) >> 20 - 1 >> >> 2 - 0 + 1 >> 2 - 0 - 1 >> >> We would not change the numbers and should insert operators between >> operands and compute the possibility values. (For example 2 + 01 may not be >> calculated) >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Code Jam" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
