Mathematics Game
Given Array := {1,2,3,4,5,6,7,8,9,10}
Get four numbers from the Array. For example: {1,3,5,8} or {1,1,3,8} or {2,2,2,2} …
So IMO there are 10*10*10*10 cases.
Then do a calculate of the four numbers with the basic operators: ADD,MINUS,MULTIPLY,DIVIDE
The operators can be duplicated.
For example: given {1,3,5,8}, We can calculate it like:
- 1*3*5*8 = 120
- 1*3*5/8 = 1.xxx
- (1+3)*5-8 = 12
- (1+3)*(5-8) = -12
Question: Give a integer N(0<N<10001), count how many times when the calculated result is equaled to N. And show the equality.
I think there might be two different answers. Considering the cases below, we could identify them as the same or the difference.
- ((1+2)+3)*6 = 36
- ((2+1)+3)*6 = 36